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

Method RequestTaskStop

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

Source from the content-addressed store, hash-verified

286}
287
288func (b *taskSessionBridge) RequestTaskStop(ctx context.Context, sessionID string, reason taskpkg.StopReason) error {
289 if ctx == nil {
290 return errors.New("daemon: request task stop context is required")
291 }
292
293 trimmedID := strings.TrimSpace(sessionID)
294 if trimmedID == "" {
295 return fmt.Errorf("%w: task session stop id is required", taskpkg.ErrValidation)
296 }
297
298 if requester, ok := b.sessions.(taskBridgeSessionRequestStopper); ok {
299 if err := requester.RequestStopWithCause(
300 ctx,
301 trimmedID,
302 taskStopCause(reason),
303 taskStopDetail(reason),
304 ); err != nil {
305 if errors.Is(err, session.ErrSessionNotFound) {
306 return nil
307 }
308 return err
309 }
310 return nil
311 }
312
313 return b.ForceTaskStop(ctx, trimmedID, reason)
314}
315
316func (b *taskSessionBridge) ForceTaskStop(ctx context.Context, sessionID string, reason taskpkg.StopReason) error {
317 if ctx == nil {

Callers

nothing calls this directly

Calls 5

ForceTaskStopMethod · 0.95
taskStopCauseFunction · 0.85
taskStopDetailFunction · 0.85
RequestStopWithCauseMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected