bosun 0.35.2 → 0.35.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/monitor.mjs CHANGED
@@ -731,19 +731,26 @@ async function pollAgentAlerts() {
731
731
  );
732
732
  }
733
733
 
734
- // Act on high-error alerts: apply a cooldown so the task-executor does not
735
- // immediately restart the same session against an API that is failing.
736
- if (alert.type === "failed_session_high_errors" && alert.task_id && internalTaskExecutor) {
734
+ // Act on failed-session alerts: apply a cooldown so task-executor does not
735
+ // immediately restart the same session against a failing API/provider.
736
+ if (
737
+ (alert.type === "failed_session_high_errors" || alert.type === "failed_session_transient_errors") &&
738
+ alert.task_id &&
739
+ internalTaskExecutor
740
+ ) {
737
741
  try {
738
742
  const taskId = alert.task_id;
739
- const cooldownUntil = Date.now() + 15 * 60_000; // 15-minute cooldown
743
+ const cooldownMs = alert.type === "failed_session_transient_errors"
744
+ ? 30 * 60_000
745
+ : 15 * 60_000;
746
+ const cooldownUntil = Date.now() + cooldownMs;
740
747
  if (typeof internalTaskExecutor.applyTaskCooldown === "function") {
741
748
  internalTaskExecutor.applyTaskCooldown(taskId, cooldownUntil);
742
749
  } else if (internalTaskExecutor._skipUntil instanceof Map) {
743
750
  internalTaskExecutor._skipUntil.set(taskId, cooldownUntil);
744
751
  }
745
752
  console.warn(
746
- `[monitor] 15m cooldown applied to task ${taskId} after ${alert.error_count || "?"} API errors (executor: ${alert.executor || "unknown"})`,
753
+ `[monitor] ${Math.round(cooldownMs / 60_000)}m cooldown applied to task ${taskId} after ${alert.error_count || "?"} API errors (${alert.type}, executor: ${alert.executor || "unknown"})`,
747
754
  );
748
755
  } catch { /* best effort */ }
749
756
  }
@@ -14857,7 +14864,12 @@ function isStreamNoise(msg) {
14857
14864
  msg.includes("This operation was aborted") ||
14858
14865
  msg.includes("setRawMode EIO") ||
14859
14866
  msg.includes("hard_timeout") ||
14860
- msg.includes("watchdog-timeout")
14867
+ msg.includes("watchdog-timeout") ||
14868
+ // Spawn failures: codex/copilot binary not found — transient noise, not a monitor bug
14869
+ msg.includes("ENOENT") ||
14870
+ msg.includes("The system cannot find the file specified") ||
14871
+ msg.includes("os error 2") ||
14872
+ msg.includes("spawn failed")
14861
14873
  );
14862
14874
  }
14863
14875
 
@@ -15479,11 +15491,18 @@ if (isExecutorDisabled()) {
15479
15491
  } else if (executorMode === "internal" || executorMode === "hybrid") {
15480
15492
  // Start internal executor
15481
15493
  try {
15494
+ const workflowOwnsTaskExecutorLifecycle = isWorkflowReplacingModule("task-executor.mjs");
15495
+ if (workflowOwnsTaskExecutorLifecycle) {
15496
+ console.log(
15497
+ "[monitor] task-executor lifecycle delegation enabled — finalization/recovery handled by workflow replacement",
15498
+ );
15499
+ }
15482
15500
  const execOpts = {
15483
15501
  ...internalExecutorConfig,
15484
15502
  repoRoot,
15485
15503
  repoSlug,
15486
15504
  agentPrompts,
15505
+ workflowOwnsTaskLifecycle: workflowOwnsTaskExecutorLifecycle,
15487
15506
  sendTelegram:
15488
15507
  telegramToken && telegramChatId
15489
15508
  ? (msg) => void sendTelegramMessage(msg)