diff options
Diffstat (limited to 'internal/api/taskops.go')
| -rw-r--r-- | internal/api/taskops.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/api/taskops.go b/internal/api/taskops.go index 254d73c..e6b6239 100644 --- a/internal/api/taskops.go +++ b/internal/api/taskops.go @@ -110,7 +110,12 @@ func (s *Server) submitTask(ctx context.Context, spec submitTaskSpec) (*task.Tas return nil, err } t.State = task.StateQueued - if err := s.pool.Submit(ctx, t); err != nil { + // Use the server's long-lived lifecycle context, not the caller's request + // context — the request (REST or chatbot MCP tool call) returns long + // before the task finishes running, and its context is cancelled when it + // does. Submitting with it would cancel the task's execution moments + // after dispatch. Mirrors the pattern at server.go's other Submit call sites. + if err := s.pool.Submit(s.ctx, t); err != nil { return nil, err } return t, nil |
