-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: resolve Kanban board stuck task state synchronization #1833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
0706459
caa235e
ddd27e4
0b35655
73b27ba
808ea8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,17 @@ export function registerAgenteventsHandlers( | |
|
|
||
| taskStateManager.handleProcessExited(taskId, code, exitTask, exitProject); | ||
|
|
||
| // Fallback safety net: If XState failed to transition the task out of in_progress, | ||
| // force it to human_review after a short delay. This prevents tasks from getting stuck | ||
| // in in_progress state when the process exits without XState properly handling it. | ||
| setTimeout(() => { | ||
| const { task: checkTask } = findTaskAndProject(taskId, projectId); | ||
| if (checkTask && checkTask.status === 'in_progress') { | ||
| console.warn(`[agent-events-handlers] Task ${taskId} still in_progress 500ms after exit, forcing to human_review`); | ||
| taskStateManager.forceTransition(taskId, 'human_review', 'errors', checkTask, exitProject); | ||
| } | ||
| }, 500); | ||
|
||
|
|
||
| // Send final plan state to renderer BEFORE unwatching | ||
| // This ensures the renderer has the final subtask data (fixes 0/0 subtask bug) | ||
| const finalPlan = fileWatcher.getCurrentPlan(taskId); | ||
|
|
@@ -225,9 +236,12 @@ export function registerAgenteventsHandlers( | |
| console.debug(`[agent-events-handlers] Skipping persistPlanPhaseSync for ${taskId}: XState in '${currentXState}', not overwriting with phase '${progress.phase}'`); | ||
| } | ||
|
|
||
| // Skip sending execution-progress to renderer when XState has settled. | ||
| // XState's emitPhaseFromState already sent the correct phase to the renderer. | ||
| if (xstateInTerminalState) { | ||
| // Skip sending execution-progress to renderer when XState has settled, | ||
| // UNLESS this is a final phase update (complete/failed). | ||
| // Final phase updates must still propagate to renderer even after XState settles, | ||
| // otherwise the UI never receives the final progress state. | ||
| const isFinalPhaseUpdate = progress.phase === 'complete' || progress.phase === 'failed'; | ||
| if (xstateInTerminalState && !isFinalPhaseUpdate) { | ||
| console.debug(`[agent-events-handlers] Skipping execution-progress to renderer for ${taskId}: XState in '${currentXState}', ignoring phase '${progress.phase}'`); | ||
| return; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -309,6 +309,10 @@ export const useTaskStore = create<TaskState>((set, get) => ({ | |||||
| // When starting a task and no phase is set yet, default to planning | ||||||
| // This prevents the "no active phase" UI state during startup race condition | ||||||
| executionProgress = { phase: 'planning' as ExecutionPhase, phaseProgress: 0, overallProgress: 0 }; | ||||||
| } else if (status === 'human_review' || status === 'error' || status === 'done' || status === 'pr_created') { | ||||||
|
||||||
| } else if (status === 'human_review' || status === 'error' || status === 'done' || status === 'pr_created') { | |
| } else if (['human_review', 'error', 'done', 'pr_created'].includes(status)) { |
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.