-
Notifications
You must be signed in to change notification settings - Fork 392
Description
Summary
When creating a spec from an empty Kanban board (via "Create Spec" button), the agent does not automatically start after clicking "Continue to Project". The user must manually click the Play button to start the agent.
Steps to Reproduce
- Create a new project with manual spec method (or have an existing project without a spec)
- Open the project in Kanban view
- Click "Create Spec" button (shown when
has_spec: false) - Complete the spec creation chat with Claude
- Click "Continue to Project" button
- Bug: Agent does not start automatically
- User must click Play button to start the agent
Expected Behavior
After clicking "Continue to Project", the agent should automatically start (same behavior as creating a new project via NewProjectModal).
Actual Behavior
- The spec chat closes and navigates to Kanban
- No
/api/projects/{project}/agent/startPOST request is made - Agent status remains "stopped"
- User must manually click Play to start the agent
Root Cause
SpecCreationChat component is used in two places with different onComplete handlers:
1. NewProjectModal.tsx (works correctly)
// ui/src/components/NewProjectModal.tsx:218
<SpecCreationChat
projectName={projectName.trim()}
onComplete={handleSpecComplete} // ✅ Calls startAgent()
...
/>2. App.tsx (missing agent start)
// ui/src/App.tsx:496-507
<SpecCreationChat
projectName={selectedProject}
onComplete={() => {
setShowSpecChat(false)
queryClient.invalidateQueries({ queryKey: ['projects'] })
queryClient.invalidateQueries({ queryKey: ['features', selectedProject] })
}} // ❌ Does NOT call startAgent()
onCancel={() => setShowSpecChat(false)}
onExitToProject={() => setShowSpecChat(false)}
/>The App.tsx version only closes the chat and refreshes queries but does not start the agent.
Proposed Fix
Update App.tsx to start the agent in the onComplete handler:
// ui/src/App.tsx
import { startAgent } from './lib/api'
// ...
<SpecCreationChat
projectName={selectedProject}
onComplete={async (_specPath, yoloMode) => {
try {
await startAgent(selectedProject, {
yoloMode: yoloMode ?? false,
maxConcurrency: 3,
})
} catch (err) {
console.error('Failed to start agent:', err)
}
setShowSpecChat(false)
queryClient.invalidateQueries({ queryKey: ['projects'] })
queryClient.invalidateQueries({ queryKey: ['features', selectedProject] })
}}
onCancel={() => setShowSpecChat(false)}
onExitToProject={() => setShowSpecChat(false)}
/>Affected Files
ui/src/App.tsx(lines 496-507)
Environment
- OS: macOS / Windows / Linux
- Browser: All browsers
Additional Context
This issue was discovered through debugging with console.log statements. The onComplete function passed to SpecCreationChat was found to be the inline function from App.tsx (which returns undefined) rather than handleSpecComplete from NewProjectModal.tsx (which returns a Promise).
Labels
bug, ui, agent