fix(ui): add fallback to prevent tasks stuck in ai_review status (#397)
* fix(ui): add fallback to prevent tasks stuck in ai_review status When a task process exits successfully (code 0), the status update to human_review was relying solely on the COMPLETE phase event being received and parsed correctly. If that event was missed due to buffering or timing issues, tasks would get stuck in ai_review. This fix adds a fallback check in the exit handler: when a process exits with code 0 and all subtasks are completed, we explicitly send a status change to human_review. This ensures tasks always progress even if the phase event is missed. Fixes: tasks stuck in AI review status bug Signed-off-by: Black Circle Sentinel <mludlow000@icloud.com> * docs: add upstream contributing guidelines to CLAUDE.md Signed-off-by: Black Circle Sentinel <mludlow000@icloud.com> * fix(ui): handle tasks without subtasks in ai_review fallback Addresses CodeRabbit's critical feedback on PR #397. Changes: - Inverts logic: uses `hasIncompleteSubtasks` instead of `allSubtasksCompleted` - Tasks with no subtasks (undefined/empty array) now correctly trigger fallback - Tasks with all completed subtasks continue to work as before This ensures ALL task types progress to human_review when process exits successfully. --------- Signed-off-by: Black Circle Sentinel <mludlow000@icloud.com> Co-authored-by: Alex <63423455+AlexMadera@users.noreply.github.com>
This commit is contained in:
@@ -248,6 +248,23 @@ main (user's branch)
|
||||
4. User runs `--merge` to add to their project
|
||||
5. User pushes to remote when ready
|
||||
|
||||
### Contributing to Upstream
|
||||
|
||||
**CRITICAL: When submitting PRs to AndyMik90/Auto-Claude, always target the `develop` branch, NOT `main`.**
|
||||
|
||||
**Correct workflow for contributions:**
|
||||
1. Fetch upstream: `git fetch upstream`
|
||||
2. Create feature branch from upstream/develop: `git checkout -b fix/my-fix upstream/develop`
|
||||
3. Make changes and commit with sign-off: `git commit -s -m "fix: description"`
|
||||
4. Push to your fork: `git push origin fix/my-fix`
|
||||
5. Create PR targeting `develop`: `gh pr create --repo AndyMik90/Auto-Claude --base develop`
|
||||
|
||||
**Verify before PR:**
|
||||
```bash
|
||||
# Ensure only your commits are included
|
||||
git log --oneline upstream/develop..HEAD
|
||||
```
|
||||
|
||||
### Security Model
|
||||
|
||||
Three-layer defense:
|
||||
|
||||
@@ -88,6 +88,22 @@ export function registerAgenteventsHandlers(
|
||||
|
||||
if (code === 0) {
|
||||
notificationService.notifyReviewNeeded(taskTitle, project.id, taskId);
|
||||
|
||||
// Fallback: Ensure status is updated even if COMPLETE phase event was missed
|
||||
// This prevents tasks from getting stuck in ai_review status
|
||||
// Uses inverted logic to also handle tasks with no subtasks (treats them as complete)
|
||||
const isActiveStatus = task.status === 'in_progress' || task.status === 'ai_review';
|
||||
const hasIncompleteSubtasks = task.subtasks && task.subtasks.length > 0 &&
|
||||
task.subtasks.some((s) => s.status !== 'completed');
|
||||
|
||||
if (isActiveStatus && !hasIncompleteSubtasks) {
|
||||
console.log(`[Task ${taskId}] Fallback: Moving to human_review (process exited successfully)`);
|
||||
mainWindow.webContents.send(
|
||||
IPC_CHANNELS.TASK_STATUS_CHANGE,
|
||||
taskId,
|
||||
'human_review' as TaskStatus
|
||||
);
|
||||
}
|
||||
} else {
|
||||
notificationService.notifyTaskFailed(taskTitle, project.id, taskId);
|
||||
mainWindow.webContents.send(
|
||||
|
||||
Reference in New Issue
Block a user