(ctx context.Context)
| 327 | |
| 328 | func (s *SubAgent) subagentRunContext(ctx context.Context) (context.Context, context.CancelFunc) { |
| 329 | if ctx == nil { |
| 330 | ctx = context.Background() |
| 331 | } |
| 332 | softDeadline := time.Now().Add(time.Duration(s.timeoutSeconds()) * time.Second) |
| 333 | if parentDeadline, ok := ctx.Deadline(); ok && parentDeadline.Before(softDeadline) { |
| 334 | return context.WithDeadline(ctx, parentDeadline) |
| 335 | } |
| 336 | return context.WithDeadline(ctx, softDeadline) |
| 337 | } |
| 338 | |
| 339 | func (s *SubAgent) timeoutSeconds() int { |
| 340 | if s.TimeoutSeconds > 0 { |
| 341 | return s.TimeoutSeconds |
no test coverage detected