#4221·career-ops

stats.mjs: "persistently dead" portal warning can never clear once a board is moved to websearch

Author: prasta1Created Sep 15, 2026Updated Sep 28, 2026
Labelsbug🔧 scripts

Summary

computePortalStats in stats.mjs counts a portal as "persistently dead" from its failure streak in data/portal-health.tsv, but never checks whether the entry is still being probed. Once an entry stops resolving to a provider it writes no further health rows, so its last failing streak stands forever.

The result is that the documented remedy is what makes the warning permanent.

Why it can't clear itself

scan.mjs skips non-resolving entries in resolveEntries() (around scan.mjs:2944) with a continue, before the fetch loop that records portal health:

javascript
const resolved = resolveProvider(entry, providers);
if (!resolved) {
  skippedCount++;
  if (entry.scan_method === 'websearch') { agentHandoff.push({...}); }
  continue;            // <- never reaches the health-recording fetch loop
}

So when a board breaks, you get slug_gone recorded N times, the streak hits portal_health_threshold, and appears. You then apply the fix the notes field itself recommends — move it to scan_method: websearch — and that is precisely what stops any further health rows from being written. The streak is frozen at its failing value permanently.

A warning that cannot be cleared by fixing the underlying problem trains the reader to ignore the whole Portals: line.

Reproduction

In my checkout, two entries (both since repaired, one over three weeks ago) have shown on every stats.mjs --summary run since:

Portals: 135 companies + 22 boards configured | 88 have produced a match (65.2%) |  2 persistently dead (run verify-portals.mjs)

Both are healthy. verify-portals.mjs reports 88 live, 6 live-but-empty, 0 unresolved — it disagrees with the stats line, and the stats line is the one that's wrong. Their last recorded health rows are slug_gone from over a month ago; both were moved to scan_method: websearch at the time, which is why the rows stop there.

Note this is not websearch-specific — any entry that stops resolving (provider dropped, renamed, careers_url changed to something unclaimed) hits the same trap. Websearch is just the path users are actively directed down.

Proposed fix

Gate the streak on the entry still being probed. Staleness measured against the newest row in the health file rather than the wall clock, so a checkout whose scanner has been idle for months still reports its last known state instead of silently going green.

Roughly 12 lines in computePortalStats, plus a portal_health_stale_days knob (default 14) alongside the existing portal_health_threshold. No behavior change for portals that are actually being probed and actually failing.

Happy to open the PR — I have the patch and a regression test passing locally against the existing suite.