MCPcopy Create free account
hub / github.com/compozy/agh / StartTask

Method StartTask

internal/api/core/tasks.go:750–791  ·  view source on GitHub ↗

StartTask explicitly enqueues one executable run for an existing task.

(c *gin.Context)

Source from the content-addressed store, hash-verified

748
749// StartTask explicitly enqueues one executable run for an existing task.
750func (h *BaseHandlers) StartTask(c *gin.Context) {
751 manager, ok := h.requireTaskManager(c)
752 if !ok {
753 return
754 }
755
756 taskID, err := requiredPathID(c.Param("id"), "task id")
757 if err != nil {
758 h.respondError(c, StatusForTaskError(err), err)
759 return
760 }
761
762 var req contract.TaskExecutionRequest
763 if err := decodeOptionalJSON(c, &req); err != nil {
764 h.respondError(
765 c,
766 http.StatusBadRequest,
767 NewTaskValidationError(fmt.Errorf("%s: decode start task request: %w", h.transportName(), err)),
768 )
769 return
770 }
771
772 actor, err := h.taskActorContext(c, taskActionStart)
773 if err != nil {
774 h.respondError(c, StatusForTaskError(err), err)
775 return
776 }
777
778 executionReq, err := taskExecutionRequestFromRequest(req)
779 if err != nil {
780 h.respondError(c, StatusForTaskError(err), err)
781 return
782 }
783
784 execution, err := manager.StartTask(c.Request.Context(), taskID, executionReq, actor)
785 if err != nil {
786 h.respondError(c, StatusForTaskError(err), err)
787 return
788 }
789
790 c.JSON(http.StatusCreated, TaskExecutionResponseFromExecution(execution))
791}
792
793// CancelTask requests cancellation for one task tree.
794func (h *BaseHandlers) CancelTask(c *gin.Context) {

Callers

nothing calls this directly

Calls 11

requireTaskManagerMethod · 0.95
respondErrorMethod · 0.95
transportNameMethod · 0.95
taskActorContextMethod · 0.95
requiredPathIDFunction · 0.85
StatusForTaskErrorFunction · 0.85
decodeOptionalJSONFunction · 0.85
NewTaskValidationErrorFunction · 0.85
StartTaskMethod · 0.65

Tested by

no test coverage detected