fix(insights): stop a briefing's model calls once its bound gives up

The nightly warm, the forced warm and the morning refresh bound a
comprehensive generation and abort it when the bound fires, but the abort
only reached the generator's final check before the cache write. The
provider calls never saw it: the call in flight ran on detached, and a
reply that landed after the bound could still start the JSON-shape,
grounding or screen retry, each a full generation nobody was waiting for.

runBriefingCompletion now takes the caller's signal, hands it to the
provider call, and reserves and sends nothing once it has fired. The
generator passes it at all five of its calls (the generation, its three
retries and the phrasing re-roll). The on-demand route passes none on
purpose: it finishes and writes its briefing after the browser stopped
waiting.

Refs #1279
This commit is contained in:
Marc-André Bombeck committed 2026-10-25 00:54:00 +02:00
1 parent 402a4a546c
commit 05cb5cf7e9
5 files changed
+80 -17

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
"count": 2897,
"total": 9259,
"total": 9256,
"entries": {
"__tests__/account-payload-consumer-guard.test.ts": 2,
"__tests__/acting-account-boundary-guard.test.ts": 7,
@@ -2158,7 +2158,7 @@
"lib/insights/chart-tokens.ts": 24,
"lib/insights/coach-launch-context.tsx": 10,
"lib/insights/comprehensive-aggregator.ts": 27,
"lib/insights/comprehensive-generate.ts": 48,
"lib/insights/comprehensive-generate.ts": 45,
"lib/insights/correlation-channel-series.ts": 16,
"lib/insights/correlation-discovery.ts": 30,
"lib/insights/correlation-series-builders.ts": 1,