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

Method handleTasksRunsCancel

internal/extension/host_api_tasks.go:445–469  ·  view source on GitHub ↗
(ctx context.Context, raw json.RawMessage)

Source from the content-addressed store, hash-verified

443}
444
445func (h *HostAPIHandler) handleTasksRunsCancel(ctx context.Context, raw json.RawMessage) (any, error) {
446 var params hostAPITaskRunCancelParams
447 if err := decodeHostAPIParams(raw, &params); err != nil {
448 return nil, err
449 }
450 runID := strings.TrimSpace(params.ID)
451 if runID == "" {
452 return nil, invalidParamsRPCError(errors.New("id is required"))
453 }
454
455 manager, actor, err := h.taskManagerAndActor(ctx)
456 if err != nil {
457 return nil, err
458 }
459 cancelReq, err := cancelTaskRunFromRequest(params.CancelTaskRunRequest)
460 if err != nil {
461 return nil, err
462 }
463
464 run, err := manager.CancelRun(ctx, runID, cancelReq, actor)
465 if err != nil {
466 return nil, mapTaskRPCError(runID, err)
467 }
468 return taskRunPayloadFromRun(run), nil
469}
470
471func (h *HostAPIHandler) taskManager() (hostAPITaskManager, error) {
472 if h == nil {

Callers

nothing calls this directly

Calls 7

taskManagerAndActorMethod · 0.95
decodeHostAPIParamsFunction · 0.85
invalidParamsRPCErrorFunction · 0.85
mapTaskRPCErrorFunction · 0.85
taskRunPayloadFromRunFunction · 0.85
cancelTaskRunFromRequestFunction · 0.70
CancelRunMethod · 0.65

Tested by

no test coverage detected