| 520 | } |
| 521 | |
| 522 | func taskManagerOptions( |
| 523 | store taskStore, |
| 524 | bridge taskpkg.SessionExecutor, |
| 525 | wakeNotifier taskpkg.WakeNotifier, |
| 526 | events taskpkg.EventObserver, |
| 527 | hooks *hooksNotifier, |
| 528 | reviewRequests taskpkg.RunReviewRequestedObserver, |
| 529 | recovery aghconfig.TaskRecoveryConfig, |
| 530 | scheduler aghconfig.SchedulerConfig, |
| 531 | blockRecurrenceLimit int, |
| 532 | ) []taskpkg.Option { |
| 533 | options := []taskpkg.Option{ |
| 534 | taskpkg.WithStore(store), |
| 535 | taskpkg.WithSessionExecutor(bridge), |
| 536 | taskpkg.WithWakeNotifier(wakeNotifier), |
| 537 | taskpkg.WithEventObserver(events), |
| 538 | taskpkg.WithRunReviewRequestedObserver(reviewRequests), |
| 539 | taskpkg.WithNetworkChannelValidator(network.ValidateChannel), |
| 540 | taskpkg.WithCancelGracePeriod(defaultTaskCancelGrace), |
| 541 | taskpkg.WithForceRecoveryOptions(taskpkg.ForceRecoveryOptions{ |
| 542 | AllowAgentForce: recovery.AllowAgentForce, |
| 543 | }), |
| 544 | taskpkg.WithStarvationAge(scheduler.MinQueuedAge), |
| 545 | taskpkg.WithBlockRecurrenceLimit(blockRecurrenceLimit), |
| 546 | } |
| 547 | if hooks != nil { |
| 548 | options = append(options, taskpkg.WithTaskRunHooks(hooks)) |
| 549 | } |
| 550 | if reader, ok := store.(taskpkg.InspectStateReader); ok { |
| 551 | options = append(options, taskpkg.WithInspectStateReader(reader)) |
| 552 | } |
| 553 | return options |
| 554 | } |
| 555 | |
| 556 | func (r *taskRuntime) submitDetachedHarnessWork( |
| 557 | ctx context.Context, |