Compare commits

...

1 Commits

Author SHA1 Message Date
Jiang Bohan
ee4e26af17 fix(quick-create): unstick queued tasks (workspace resolution + WS wakeup)
Two related bugs that combined to leave every quick-create task in
'queued' from the user's POV:

1. ResolveTaskWorkspaceID returned "" for any task whose
   issue_id / chat_session_id / autopilot_run_id were all NULL —
   exactly the shape of a quick-create task. That made
   requireDaemonTaskAccess 404 on the daemon's /start, /progress,
   /complete, /fail endpoints, and silently dropped task:dispatch /
   task:completed broadcasts. Even when the claim itself succeeded,
   the daemon couldn't drive the task forward, so it stalled and
   eventually got swept back. Read the workspace from the
   QuickCreateContext JSONB so every downstream lookup works.

2. EnqueueQuickCreateTask never called notifyTaskAvailable, so the
   daemon WS wakeup never fired for quick-create. The 30 s poll
   fallback would eventually pick the task up, but combined with #1
   that meant the task spent the bulk of its life looking like
   "queued, never triggered". Match the chat / issue / autopilot
   enqueue paths and signal the wakeup.
2026-04-29 14:55:31 +08:00

View File

@@ -180,6 +180,12 @@ func (s *TaskService) EnqueueQuickCreateTask(ctx context.Context, workspaceID, r
"requester_id", util.UUIDToString(requesterID),
"workspace_id", util.UUIDToString(workspaceID),
)
// Match every other Enqueue* path: kick the daemon WS so the task
// gets claimed promptly instead of waiting for the next 30 s poll
// cycle. Without this the user perceives "quick create never
// triggered" because the modal closes immediately and the task
// sits in 'queued' until the next sleepWithContextOrWakeup tick.
s.notifyTaskAvailable(task)
return task, nil
}
@@ -1096,6 +1102,14 @@ func (s *TaskService) ResolveTaskWorkspaceID(ctx context.Context, task db.AgentT
}
}
}
// Quick-create tasks have no issue / chat / autopilot link — workspace
// lives in the context JSONB. Returning "" here is what blocked
// requireDaemonTaskAccess (404 on /start, /progress, /complete, /fail
// for the daemon) and silently dropped task:dispatch / task:completed
// broadcasts, which is why quick-create tasks appeared stuck queued.
if qc, ok := s.parseQuickCreateContext(task); ok {
return qc.WorkspaceID
}
return ""
}