The agent was running in an infinite loop when all kanban features were
completed. This happened because:
1. The main loop in agent.py had no completion detection
2. The coding prompt instructs Claude to run regression tests BEFORE
checking for new features
3. feature_get_next() returns "All features passing!" but nothing acted on it
This fix adds three completion checks:
1. Pre-loop check: Exits immediately if project is already 100% complete
when the agent starts (avoids running unnecessary sessions)
2. Post-session check: After each session, checks if all features are now
passing and exits gracefully with a success message
3. Single-feature mode: Exits after one session since the parallel
orchestrator manages spawning new agents for other features
Tested with a project that had 240/240 features passing - agent now exits
immediately with "ALL FEATURES ALREADY COMPLETE!" message.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Critical fixes:
- Lock file TOCTOU race condition: Use atomic O_CREAT|O_EXCL for lock creation
- PID reuse vulnerability on Windows: Store PID:CREATE_TIME in lock file to
detect when a different process has reused the same PID
- WAL mode on network drives: Detect network paths (UNC, mapped drives, NFS,
CIFS) and fall back to DELETE journal mode to prevent corruption
High priority fixes:
- JSON migration now preserves dependencies field during legacy migration
- Process tree termination on Windows: Use psutil to kill child processes
recursively to prevent orphaned browser instances
- Retry backoff jitter: Add random 30% jitter to prevent synchronized retries
under high contention with 5 concurrent agents
Files changed:
- server/services/process_manager.py: Atomic lock creation, PID+create_time
- api/database.py: Network filesystem detection for WAL mode fallback
- api/migration.py: Add dependencies field to JSON migration
- parallel_orchestrator.py: _kill_process_tree helper function
- mcp_server/feature_mcp.py: Add jitter to exponential backoff
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Memoize onNodeClick callback in App.tsx to prevent unnecessary re-renders
- Add useRef pattern in DependencyGraph to store callback without triggering
useMemo recalculation when callback identity changes
- Add hash-based change detection to only update ReactFlow state when
actual graph data changes (node status, edges), not on every parent render
- Add GraphErrorBoundary class component to catch ReactFlow rendering errors
and provide a "Reload Graph" recovery button instead of blank screen
- Wrap DependencyGraph with error boundary and resetKey for graceful recovery
The root cause was frequent WebSocket updates during active agent sessions
causing parent re-renders, which created new inline callback functions,
triggering useMemo/useEffect chains that corrupted ReactFlow's internal state
over time (approximately 1 minute of continuous updates).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Add per-agent log viewer with copy-to-clipboard functionality
- New AgentLogEntry type for structured log entries
- Logs stored per-agent in WebSocket state (up to 500 entries)
- Log modal rendered via React Portal to avoid overflow issues
- Click log icon on agent card to view full activity history
- Fix agents getting stuck in "failed" state
- Wrap client context manager in try/except (agent.py)
- Remove failed agents from UI on error state (useWebSocket.ts)
- Handle permanently failed features in get_all_complete()
- Add friendlier agent state labels
- "Hit an issue" → "Trying plan B..."
- "Retrying..." → "Being persistent..."
- Softer colors (yellow/orange instead of red)
- Add scheduling scores for smarter feature ordering
- compute_scheduling_scores() in dependency_resolver.py
- Features that unblock others get higher priority
- Update CLAUDE.md with parallel mode documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major feature implementation for parallel agent execution with dependency-aware
scheduling and an engaging multi-agent UI experience.
Backend Changes:
- Add parallel_orchestrator.py for concurrent feature processing
- Add api/dependency_resolver.py with cycle detection (Kahn's algorithm + DFS)
- Add atomic feature_claim_next() with retry limit and exponential backoff
- Fix circular dependency check arguments in 4 locations
- Add AgentTracker class for parsing agent output and emitting updates
- Add browser isolation with --isolated flag for Playwright MCP
- Extend WebSocket protocol with agent_update messages and log attribution
- Add WSAgentUpdateMessage schema with agent states and mascot names
- Fix WSProgressMessage to include in_progress field
New UI Components:
- AgentMissionControl: Dashboard showing active agents with collapsible activity
- AgentCard: Individual agent status with avatar and thought bubble
- AgentAvatar: SVG mascots (Spark, Fizz, Octo, Hoot, Buzz) with animations
- ActivityFeed: Recent activity stream with stable keys (no flickering)
- CelebrationOverlay: Confetti animation with click/Escape dismiss
- DependencyGraph: Interactive node graph visualization with dagre layout
- DependencyBadge: Visual indicator for feature dependencies
- ViewToggle: Switch between Kanban and Graph views
- KeyboardShortcutsHelp: Help overlay accessible via ? key
UI/UX Improvements:
- Celebration queue system to handle rapid success messages
- Accessibility attributes on AgentAvatar (role, aria-label, aria-live)
- Collapsible Recent Activity section with persisted preference
- Agent count display in header
- Keyboard shortcut G to toggle Kanban/Graph view
- Real-time thought bubbles and state animations
Bug Fixes:
- Fix circular dependency validation (swapped source/target arguments)
- Add MAX_CLAIM_RETRIES=10 to prevent stack overflow under contention
- Fix THOUGHT_PATTERNS to match actual [Tool: name] format
- Fix ActivityFeed key prop to prevent re-renders on new items
- Add featureId/agentIndex to log messages for proper attribution
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Complete the defense-in-depth approach from PR #53 by adding explicit
in_progress=False to all remaining feature creation locations. This
ensures consistency with the MCP server pattern and prevents potential
NULL values in the in_progress field.
Changes:
- server/routers/features.py: Add in_progress=False to create_feature()
and create_features_bulk() endpoints
- server/services/expand_chat_session.py: Add in_progress=False to
_create_features_bulk() in the expand chat session
- api/migration.py: Add in_progress field handling in JSON migration,
reading from source data with False as default
This follows up on PR #53 which added nullable=False constraints and
fixed existing NULL values, but only updated the MCP server creation
paths. Now all 6 feature creation locations explicitly set both
passes=False and in_progress=False.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace JSON output approach with direct MCP tool call in the
/expand-project CLI command to fix feature persistence issue.
Changes:
- Update expand-project.md to call feature_create_bulk MCP tool
- Remove <features_to_create> JSON tag output (not parsed in CLI)
- Simplify confirmation message before feature creation
Why:
- CLI users running /expand-project had features displayed but never
saved to database because nothing parsed the JSON output
- Web UI is unaffected (uses expand_chat_session.py with its own parser)
- This mirrors how initializer_prompt.template.md already works
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ChatMessage: use CSS variable syntax for bg-neo-accent and text consistency
- DebugLogViewer: fix info log level to use --color-neo-log-info
- TerminalTabs: use neo-hover-subtle for hover states instead of text color
- globals.css: fix shimmer effect selector to target .neo-progress-fill
- globals.css: fix loading spinner visibility with explicit border color
- globals.css: add will-change for .neo-btn-yolo performance
- App.tsx: group constants after imports
- NewProjectModal: remove redundant styling (neo-card provides these)
- Add tsconfig.tsbuildinfo to .gitignore and remove from tracking
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add the ability for users to edit features that are not yet completed,
allowing them to provide corrections or additional instructions when the
agent is stuck or implementing a feature incorrectly.
Backend changes:
- Add FeatureUpdate schema in server/schemas.py with optional fields
- Add PATCH /api/projects/{project_name}/features/{feature_id} endpoint
- Validate that completed features (passes=True) cannot be edited
Frontend changes:
- Add FeatureUpdate type in ui/src/lib/types.ts
- Add updateFeature() API function in ui/src/lib/api.ts
- Add useUpdateFeature() React Query mutation hook
- Create EditFeatureForm.tsx component with pre-filled form values
- Update FeatureModal.tsx with Edit button for non-completed features
The edit form allows modifying category, name, description, priority,
and test steps. Save button is disabled until changes are detected.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The model was hardcoded to "claude-opus-4-5-20251101" in chat session
services, ignoring the ANTHROPIC_DEFAULT_OPUS_MODEL environment variable.
This caused issues when using alternative API providers (e.g., GLM via z.ai)
that don't support Claude model names.
Fixes#51
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add skill to convert GSD codebase mapping (.planning/codebase/*.md)
to Autocoder app_spec.txt format.
This enables onboarding existing projects to Autocoder without
manually writing the XML spec.
Workflow:
1. Run /gsd:map-codebase on existing project
2. Run /gsd-to-autocoder-spec to generate app_spec.txt
3. Start Autocoder normally
Closes#55
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Problem: Features with NULL values in passes/in_progress fields caused
Pydantic validation errors in the API.
Solution - defense in depth:
1. Database model: Add nullable=False to passes and in_progress columns
2. Migration: Auto-fix existing NULL values to False on database connect
3. API layer: Handle NULL gracefully in feature_to_response (treat as False)
4. MCP server: Explicitly set in_progress=False when creating features
This ensures:
- New databases cannot have NULL boolean fields
- Existing databases are auto-migrated on connect
- Even if NULL values exist, they're handled gracefully at runtime
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Write system prompts to CLAUDE.md file instead of passing inline
- Use setting_sources=["project"] to load prompts from file
- Affects spec_chat_session.py and assistant_chat_session.py
Why:
- Windows has ~8191 character command line limit
- System prompts (e.g., create-spec.md at ~19KB) exceeded this limit
- The SDK serializes system_prompt as a CLI argument
- Writing to file and using setting_sources bypasses the limit
This completes the fix for GitHub issue #33 (Windows "Command Line Too Long").
The previous commit removed **os.environ from MCP configs; this commit
addresses the larger system prompt issue.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for using alternative API endpoints (like Zhipu AI's GLM models)
without affecting the user's global Claude Code settings. Configuration is
done via AutoCoder's .env file.
Changes:
- Add API_ENV_VARS constant and pass through ClaudeAgentOptions.env parameter
in client.py and all server service files (spec, expand, assistant sessions)
- Add glm_mode to settings API response to indicate when GLM is configured
- Add purple "GLM" badge in UI header when GLM mode is active
- Update setup status to accept GLM credentials as valid authentication
- Update .env.example with GLM configuration documentation
- Update README.md with AutoCoder-scoped GLM setup instructions
Supported environment variables:
- ANTHROPIC_BASE_URL: Custom API endpoint (e.g., https://api.z.ai/api/anthropic)
- ANTHROPIC_AUTH_TOKEN: API authentication token
- API_TIMEOUT_MS: Request timeout in milliseconds
- ANTHROPIC_DEFAULT_SONNET_MODEL: Model override for Sonnet
- ANTHROPIC_DEFAULT_OPUS_MODEL: Model override for Opus
- ANTHROPIC_DEFAULT_HAIKU_MODEL: Model override for Haiku
This approach routes API requests through the alternative endpoint while
keeping all Claude Code features (MCP servers, hooks, permissions) intact.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for multiple terminal instances per project with tabbed
navigation in the debug panel. Each terminal maintains its own PTY
session and WebSocket connection.
Backend changes:
- Add terminal metadata storage (id, name, created_at) per project
- Update terminal_manager.py with create, list, rename, delete functions
- Extend WebSocket endpoint to /api/terminal/ws/{project}/{terminal_id}
- Add REST endpoints for terminal CRUD operations
- Implement deferred PTY start with initial resize message
Frontend changes:
- Create TerminalTabs component with neobrutalism styling
- Support double-click rename and right-click context menu
- Fix terminal switching issues with transform-based hiding
- Use isActiveRef to prevent stale closure bugs in connect()
- Add double requestAnimationFrame for reliable activation timing
- Implement proper dimension validation in fitTerminal()
Other updates:
- Add GLM model configuration documentation to README
- Simplify client.py by removing CLI_COMMAND support
- Update chat session services with consistent patterns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new features for interactive terminal sessions and dev server control:
Terminal Component:
- New Terminal.tsx component using xterm.js for full terminal emulation
- WebSocket-based PTY communication with bidirectional I/O
- Cross-platform support (Windows via winpty, Unix via built-in pty)
- Auto-reconnection with exponential backoff
- Fix duplicate WebSocket connection bug by checking CONNECTING state
- Add manual close flag to prevent auto-reconnect race conditions
- Add project tracking to avoid duplicate connects on initial activation
Dev Server Management:
- New DevServerControl.tsx for starting/stopping dev servers
- DevServerManager service for subprocess management
- WebSocket streaming of dev server output
- Project configuration service for reading package.json scripts
Backend Infrastructure:
- Terminal router with WebSocket endpoint for PTY I/O
- DevServer router for server lifecycle management
- Terminal session manager with callback-based output streaming
- Enhanced WebSocket schemas for terminal and dev server messages
UI Integration:
- New Terminal and Dev Server tabs in the main application
- Updated DebugLogViewer with improved UI and functionality
- Extended useWebSocket hook for terminal message handling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add state reset at the start of the project change effect in
useWebSocket hook. This clears stale progress data, agent status,
and logs when the user switches to a different project, preventing
display of outdated information from the previous project.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove automatic subfolder creation when creating projects. Users now
select the exact folder they want to use, enabling support for existing
projects without requiring folder names to match project names.
Changes:
- NewProjectModal.tsx: Remove path concatenation that appended project
name to selected folder. Update instruction text to clarify users
select THE project folder, not a parent location.
- FolderBrowser.tsx: Add visual indicator "This folder will contain
all project files" to clarify selection behavior.
- projects.py: Add duplicate path validation to prevent multiple
projects from registering the same directory. Includes case-insensitive
path comparison on Windows for proper cross-platform support.
This allows users to:
- Use Auto Coder on existing projects by selecting their folder directly
- Have project names that differ from folder names (name is a registry label)
- Get clear feedback when a path is already registered under another name
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The Chat AI Assistant button (AssistantFAB) was appearing on top of the
full-screen spec creation chat overlay, causing a visual bug where the
button would overlap with the Send input area.
Changes:
- Add onStepChange callback prop to NewProjectModal to notify parent
when the modal step changes
- Add onSpecCreatingChange callback prop to ProjectSelector to propagate
spec creation state up to App.tsx
- Add isSpecCreating state to App.tsx to track when spec creation chat
is active
- Update AssistantFAB render condition to include !isSpecCreating
- Disable 'A' keyboard shortcut during spec creation mode
The fix propagates the spec creation state through the component
hierarchy: NewProjectModal -> ProjectSelector -> App.tsx, allowing
the FAB to be hidden when step === 'chat' in the new project modal.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move the "Add Feature" (+) and "Expand Project" (sparkles) buttons from
the top navigation bar to the Pending column header in the Kanban board.
Changes:
- KanbanColumn: Add optional onAddFeature, onExpandProject, and
showExpandButton props; render action buttons in column header
- KanbanBoard: Accept and pass action handlers to the Pending column
- App: Remove buttons from header, pass handlers to KanbanBoard
This improves UX by placing feature creation actions contextually near
the pending features they affect. Keyboard shortcuts (N, E) still work.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for alternative CLI commands via CLI_COMMAND environment
variable, allowing users to use CLIs other than 'claude' (e.g., 'glm').
This change affects all server services and the main CLI launcher.
Key changes:
- Configurable CLI command via CLI_COMMAND env var (defaults to 'claude')
- Configurable Playwright headless mode via PLAYWRIGHT_HEADLESS env var
- Pin claude-agent-sdk version to <0.2.0 for stability
- Use tail -500 for progress notes to avoid context overflow
- Add project delete functionality with confirmation dialog
- Replace single-line input with resizable textarea in spec chat
- Add coder agent configuration for code implementation tasks
- Ignore issues/ directory in git
Files modified:
- client.py: CLI command and Playwright headless configuration
- server/main.py, server/services/*: CLI command configuration
- start.py: CLI command configuration and error messages
- .env.example: Document new environment variables
- .gitignore: Ignore issues/ directory
- requirements.txt: Pin SDK version
- .claude/templates/*: Use tail -500 for progress notes
- ui/src/components/ProjectSelector.tsx: Add delete button
- ui/src/components/SpecCreationChat.tsx: Auto-resizing textarea
- ui/src/components/ConfirmDialog.tsx: New reusable dialog
- .claude/agents/coder.md: New coder agent configuration
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit addresses issues found during review of PRs #12 and #28:
## PR #12 (Auth Error Handling) Fixes
- Create shared auth.py module with centralized AUTH_ERROR_PATTERNS,
is_auth_error(), and print_auth_error_help() functions
- Fix start.bat to use directory check instead of outdated
.credentials.json file check (matching start.sh behavior)
- Update process_manager.py to import from shared auth module
- Update start.py to import from shared auth module
- Update documentation comments in autonomous_agent_demo.py and
client.py to remove references to deprecated .credentials.json
## PR #28 (Feature Management) Improvements
- Add _priority_lock threading lock to feature_mcp.py to prevent
race conditions when multiple features are created simultaneously
- Apply lock to feature_create, feature_create_bulk, and feature_skip
- Add checkAndSendTimeoutRef cleanup in useAssistantChat.ts to
prevent memory leaks on component unmount
- Clear currentAssistantMessageRef on response_done
## Code Quality
- All Python files pass ruff linting
- All security tests pass (91/91)
- UI passes ESLint and TypeScript compilation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test_hook helper function was being incorrectly interpreted by pytest
as a test function due to the 'test_' prefix. Pytest attempted to inject
fixtures for its parameters (command, should_block), causing an error.
Changes:
- Renamed test_hook() to check_hook() in test_security.py
- Updated all call sites (lines 206 and 276)
- Updated docstring to clarify it's a helper function
This fixes the "fixture 'command' not found" error when running pytest.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- start_ui.sh, start.sh: Check for venv/bin/activate instead of just
venv/ directory to detect Windows venvs in Linux/WSL
- Auto-recreate venv when incompatible platform structure detected
- Add error handling for venv removal, creation, and activation failures
- Provide actionable error messages with distro-specific instructions
- start_ui.bat: Check for venv\Scripts\activate.bat for consistency
with start.bat pattern
Fixes issue where users cloning repo in WSL would encounter:
- "venv/bin/activate: No such file or directory"
- "No module named pip" errors
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Applied Fixes
More flexible string matching: Changed from response.lower().strip().startswith("limit reached") to "limit reached" in response.lower() to handle cases where the message has prefix text or variations in whitespace.
Improved regex pattern: Updated to r"(?i)\bresets(?:\s+at)?\s+(\d+)(?::(\d+))?\s*(am|pm)\s*\(([^)]+)\)" which now handles:
Optional "at" after "resets" (e.g., "resets at 3pm" or "resets 3pm")
Flexible whitespace around components
Word boundaries to prevent partial matches
Timezone sanitization: Added .strip() to tz_name = match.group(4).strip() to remove any leading/trailing whitespace that could cause ZoneInfo() to fail.
Safety clamp: Added delay_seconds = min(delta.total_seconds(), 24 * 60 * 60) to ensure the delay never exceeds 24 hours, preventing the agent from being stuck waiting for extremely long periods.
- Add language specifier to fenced code block in expand-project.md
- Remove detailed exception strings from WebSocket responses (security)
- Make WebSocket "start" message idempotent to avoid session reset
- Fix race condition in bulk feature creation with row-level lock
- Add validation for starting_priority (must be >= 1)
- Fix _query_claude to handle multiple feature blocks and deduplicate
- Add FileReader error handling in ExpandProjectChat
- Fix disconnect() to clear pending reconnect timeout
- Enable sandbox mode and validate CLI path in expand_chat_session
- Clean up temporary settings file on session close
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds the ability to add multiple features to an existing project through
a natural language conversation with Claude, similar to how initial spec
creation works.
Features:
- New "Expand" button in header (keyboard shortcut: E)
- Full-screen chat interface for describing new features
- Claude reads existing app_spec.txt for context
- Features created directly in database after user approval
- Bulk feature creation endpoint for batch operations
New files:
- .claude/commands/expand-project.md - Claude skill for expansion
- server/services/expand_chat_session.py - Chat session service
- server/routers/expand_project.py - WebSocket endpoint
- ui/src/components/ExpandProjectChat.tsx - Chat UI
- ui/src/components/ExpandProjectModal.tsx - Modal wrapper
- ui/src/hooks/useExpandChat.ts - WebSocket hook
Modified:
- Added POST /bulk endpoint to features router
- Added FeatureBulkCreate schemas
- Integrated Expand button and modal in App.tsx
Co-Authored-By: Claude <noreply@anthropic.com>
Match the same validation constraints used in FeatureCreateItem:
- category: min_length=1, max_length=100
- name: min_length=1, max_length=255
- description: min_length=1
- steps: min_length=1
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Allow users to interact with the project assistant to create features
through natural conversation. The assistant can now:
- Create single features via `feature_create` tool
- Create multiple features via `feature_create_bulk`
- Skip features to deprioritize them via `feature_skip`
Changes:
- Add `feature_create` MCP tool for single-feature creation
- Update assistant allowed tools to include feature management
- Update system prompt to explain new capabilities
- Enhance UI tool call display with friendly messages
Security: File system access remains read-only. The assistant cannot
modify source code or mark features as passing (requires actual
implementation by the coding agent).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>