worldmonitor icon indicating copy to clipboard operation
worldmonitor copied to clipboard

fix(summarization): stop logging 'All providers failed' for declined-by-design chains (#5377)

Open lspassos1 opened this issue 4 months ago • 3 comments

Summary

Closes #5377 (remaining acceptance item).

Status of the issue's two parts:

  1. Enqueue gate (part 1) — already landed. #5377 was filed against a checkout that predated #4915 (merged 2026-07-05), which wired configureSummarizeGate(() => hasPremiumAccess()) into summarization.ts; tryApiProvider consults canAttemptServerSummarization() before any network dispatch, so anon/free loads issue zero summarize-article RPCs. That wiring is already pinned by tests/summarize-entitlement-gate.test.mts (gate-before-RPC, single choke point, 403-drift suppression). Nothing to do.
  2. Misleading log (part 2) — fixed here. Both chain-exhausted sites ([BETA] and normal mode) still warned All providers failed even when nothing was attempted — the gate had declined every server dispatch and browser T5 was unavailable, i.e. the designed anonymous path. That outage-shaped warning is indistinguishable from a real provider failure in console triage (it cost the issue's investigation two wrong hypotheses).

Fix: both sites route through a logChainOutcome() helper. When lastAttemptedProvider is still 'none' — tryApiProvider marks attempts only after the feature + entitlement gates pass, and tryBrowserT5 only after the mlWorker.isAvailable check, so 'none' reliably means "declined by design" — it logs at debug with an accurate "skipped: no eligible provider" message. warn with All providers failed is reserved for chains where at least one provider was genuinely attempted and failed.

Type of change

  • [x] Bug fix

Affected areas

  • [x] AI Insights / World Brief
  • [x] Other: console/Sentry triage signal quality

Checklist

  • [ ] Tested on worldmonitor.app variant
  • [ ] Tested on tech.worldmonitor.app variant (if applicable)
  • [ ] New RSS feed domains added to api/rss-proxy.js allowlist (if adding feeds)
  • [x] No API keys or secrets committed
  • [x] TypeScript compiles without errors (npm run typecheck)

Documentation Alignment Checklist

N/A — logging-only change; no API contracts or documented behavior touched.

Verification

  • Extended tests/summarize-entitlement-gate.test.mts (source-grep suite, same idiom as the existing wiring assertions): fail sites must route through logChainOutcome — no unconditional string-literal All providers failed warn may reappear; the 'none' branch must log at debug before any warn; attempt marking must stay behind the gates so 'none' means declined-by-design.
  • 21/21 green with the fix; RED (1 fail) against the pre-fix source.
  • npm run typecheck clean.

Acceptance mapping (from the issue)

  • "Anonymous load issues zero summarize requests" — already true via #4915's gate; pinned by the existing suite.
  • "Signed-in premium path still summarizes normally" — untouched; gate/probe logic unchanged.
  • "All providers failed no longer appears on a healthy anon load; a real provider failure still surfaces at warn" — this PR.

Screenshots

N/A — console logging change.


Generated by Claude Code

lspassos1 avatar Jul 25 '26 19:07 lspassos1

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
worldmonitor Ignored Ignored Preview Jul 26, 2026 6:37am

Request Review

vercel[bot] avatar Jul 25 '26 19:07 vercel[bot]

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
WorldMonitor 🟢 Ready View Preview Jul 25, 2026, 10:10 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

mintlify[bot] avatar Jul 25 '26 22:07 mintlify[bot]

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
WorldMonitor 🟡 Building – Jul 25, 2026, 10:09 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

mintlify[bot] avatar Jul 25 '26 22:07 mintlify[bot]