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

Method ForceTaskStop

internal/daemon/task_runtime.go:316–333  ·  view source on GitHub ↗
(ctx context.Context, sessionID string, reason taskpkg.StopReason)

Source from the content-addressed store, hash-verified

314}
315
316func (b *taskSessionBridge) ForceTaskStop(ctx context.Context, sessionID string, reason taskpkg.StopReason) error {
317 if ctx == nil {
318 return errors.New("daemon: force task stop context is required")
319 }
320
321 trimmedID := strings.TrimSpace(sessionID)
322 if trimmedID == "" {
323 return fmt.Errorf("%w: task session stop id is required", taskpkg.ErrValidation)
324 }
325
326 if err := b.sessions.StopWithCause(ctx, trimmedID, taskStopCause(reason), taskStopDetail(reason)); err != nil {
327 if errors.Is(err, session.ErrSessionNotFound) {
328 return nil
329 }
330 return err
331 }
332 return nil
333}
334
335func (d *Daemon) bootTasks(ctx context.Context, state *bootState) error {
336 if state == nil || state.registry == nil || state.sessions == nil {

Callers 1

RequestTaskStopMethod · 0.95

Calls 4

taskStopCauseFunction · 0.85
taskStopDetailFunction · 0.85
StopWithCauseMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected