fix: user workflow deadlock (#677)

This commit is contained in:
Carlos Florêncio
2026-04-23 09:54:06 +01:00
committed by GitHub
parent 86b3099631
commit 6ffb157d7e
15 changed files with 607 additions and 115 deletions
@@ -408,10 +408,11 @@ func (h *TaskHandlers) httpCreateTask(c *gin.Context) {
return
}
// When not starting the agent immediately, persist profile IDs in task metadata
// so handleTaskMovedNoSession can retrieve them when the task is later dragged
// to a step with auto_start_agent.
if !body.StartAgent && !body.PrepareSession && body.AgentProfileID != "" {
// Always persist profile IDs in task metadata so they can be used as the
// task's "default" agent profile. This is needed both for deferred agent start
// (handleTaskMovedNoSession) and for reverting to the default agent when a
// workflow step has no agent_profile override.
if body.AgentProfileID != "" {
if body.Metadata == nil {
body.Metadata = make(map[string]interface{})
}
@@ -128,10 +128,11 @@ func (h *TaskHandlers) wsCreateTask(ctx context.Context, msg *ws.Message) (*ws.M
})
}
// When not starting the agent immediately, persist profile IDs in task metadata
// so handleTaskMovedNoSession can retrieve them when the task is later dragged
// to a step with auto_start_agent.
if !req.StartAgent && req.AgentProfileID != "" {
// Always persist profile IDs in task metadata so they can be used as the
// task's "default" agent profile. This is needed both for deferred agent start
// (handleTaskMovedNoSession) and for reverting to the default agent when a
// workflow step has no agent_profile override.
if req.AgentProfileID != "" {
if req.Metadata == nil {
req.Metadata = make(map[string]interface{})
}