From 6245fb72c86cb5e7a65c6e599a8eb847f707bcf1 Mon Sep 17 00:00:00 2001 From: nullStack65 <112618179+nullStack65@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:45:37 +0000 Subject: [PATCH] fix(server): a newer run no longer drops a queued model alert PR #100 added a delivery-time staleness check that drops an alert once its thread has a newer run that runs or finished. Model alerts went through it too. A later run with the same problem is kept quiet on purpose (one alert per signature), so the first run's model-substitution alert was dropped and the watcher never heard it. Model alerts still drop when the thread is gone, archived, settled, on another provider or replaced by its parent; only the newer-run check is skipped for them. Usage-limit incidents and thread events keep it. Fixes DelegatedCompletionDelivery "alerts the watcher and the parent once when a child ran another model", failing in T3 fork ARC CI since #100. Co-Authored-By: Claude Opus 5.5 --- .../src/orchestration-v2/ModelAlertReactor.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/server/src/orchestration-v2/ModelAlertReactor.ts b/apps/server/src/orchestration-v2/ModelAlertReactor.ts index 0b48d5169e93..a0a9d4e9c3ad 100644 --- a/apps/server/src/orchestration-v2/ModelAlertReactor.ts +++ b/apps/server/src/orchestration-v2/ModelAlertReactor.ts @@ -728,7 +728,7 @@ export const make = Effect.gen(function* () { /** * The alert as it stands now: threads that moved on leave it, and null means nothing is left to * say. A thread moved on when it has a newer run that runs or finished, is settled, archived or - * on another provider, or its parent replaced it. + * on another provider, or its parent replaced it. A model alert ignores newer runs. */ const currentAlert = Effect.fnUntraced(function* (alert: WatcherAlert) { const stillCurrent = Effect.fnUntraced(function* ( @@ -749,11 +749,13 @@ export const make = Effect.gen(function* () { if (fresh.length === 0) return null; return fresh.length === alert.members.length ? alert : { ...alert, members: fresh }; } - const about = - alert.type === "model-degraded" - ? { providerInstanceId: alert.providerInstanceId } - : undefined; - return (yield* stillCurrent(alert.threadId, alert.runId, about)) ? alert : null; + if (alert.type === "model-degraded") { + // A newer run does not answer a model alert: a run with the same problem stays quiet by + // design (recordModelAlert), so dropping this one would mean the watcher never hears it. + const about = { providerInstanceId: alert.providerInstanceId }; + return (yield* stillCurrent(alert.threadId, null, about)) ? alert : null; + } + return (yield* stillCurrent(alert.threadId, alert.runId, undefined)) ? alert : null; }); /**