Keep the DeepSeek poll when its pricing page parses 0 rows #368
main fromclaude/wizardly-hamilton-4q3t2f·merged by tombeckenham View on GitHubCloses #367
Problem#
Since 12:45 UTC today, every DeepSeek models poll has failed with deepseek pricing page: parsed 0 model rows (11 times on 2026-10-19 15:00–18:59 UTC as well). The pricing load ran outside tryDocs, so the fail-closed throw from assertParsed escaped listModels and took the whole DeepSeek poll down with it: no listing diff, no reasoning or replay facts, lastPolledAt stuck.
The page itself hasn't changed (last-modified 2026-10-19 06:05 UTC). Fetched from outside Cloudflare it still parses to both rows, so the Worker sometimes gets a different body from the CDN (Tencent EdgeOne).
Change#
adapters/deepseek.ts: load pricing and the thinking guide (same docs host) throughtryDocs. When one fails, each row getsunavailable('pricing')or, for rows with reasoning,unavailable('requestMap'), so stored values are kept, never nulled or invented. Failures are returned asdocsFailures, which still emitsingest_failed(now withsource) and shows on/v1/statusasdocsFailing. The listing is still not wrapped.absentmaps merge rather than replace.provider-replay.ts:loadReplayDoctakes an optionalcachedloader (so thetryDocsfailure budget applies) and an optionalverify, which runs before caching. Without it, a bad body from the host would sit in KV for six hours and keep failing the poll after the host recovered. Other callers are unchanged (defaults).deepseek-pricing.ts:deepseekModelPricingtakes thecachedloadertryDocshands it. On a zero-row parse it throwsdeepseek pricing page (<n> chars, title "<title>"): parsed 0 model rows, so the next failure says what the Worker got. Theparse_rowssource label staysdeepseek pricing page, so the drop alert's distinct-source count doesn't change.- Tests: (1) a pricing body with no table leaves the row listed with
absent.pricing: 'unavailable'and one described docs failure; (2) both pages serving such a body leave the row listed with pricing and requestMap unavailable and two failures. Both fail without the fix.
Review notes (non-critical, not changed)#
ingest_failedfor this failure now carriessource: <url>and is no longer a job-level failure. Anything filtering on the old exact message or on job-level DeepSeek failures needs updating.- A model first listed during an outage is stored with null pricing until the next healthy poll. The provider-level
docsFailingflags it. - The zero-row check sits ahead of
assertParsed, whose own zero-row branch can no longer fire for this source; it still emitsparse_rows. - Untested: a body with no
<title>(renderstitle null), and that a healthy poll returnsdocsFailures.failed === 0. - The root cause of the bad body (which CDN variant the Worker receives) needs the new error text from production before anyone can act on it.
Checks#
bun run test (2073 passed), bun --bun run lint, bun run typecheck, bun --bun run check: all clean.
🤖 Generated with Claude Code
- 1
Triage summary#
What it solves Every DeepSeek models poll since 12:45 UTC today failed because the pricing page sometimes parses to 0 rows on the Worker, and that load (plus the thinking guide on the same host) ran outside tryDocs. Now the poll survives, and the failing docs are reported asdocsFailures.Does it matter Yes. While the page misbehaves, DeepSeek gets no listing diff, no new models, no reasoning or replay facts. 16 failed polls in the last 7 days, all since 2026-10-19. Added complexity Small. About 40 lines in the adapter, plus two optional parameters on loadReplayDocwhose defaults keep the other callers unchanged. Same pattern as Fireworks/NVIDIA.Fallbacks that should be errors None. Prices and the replay request map are kept from what is stored ( unavailable), never invented or nulled. The parser still throws on a zero-row page, the failure is stillingest_failedplus/v1/statusdocsFailing, and bad bodies are no longer cached.Public type/API changes None. The /v1/statusshape is unchanged. Internal:deepseekModelPricing(kv, cached),loadReplayDoc(url, kv?, cached?, verify?).Users helped/hurt Helped: catalog consumers get fresh DeepSeek rows while the docs host is flaky. Hurt: a PostHog filter on the old exact error string or on job-level DeepSeek failures would miss the new event shape (it now carries source).Standards compliance Follows CLAUDE.md: docs loads go through tryDocs, the listing is not wrapped, parsers stay strict, no hardcoded values. Regression tests are not undersrc/routes/. Lint, typecheck, prettier and 2073 tests pass.Verdict Approve. It brings DeepSeek in line with the documented tryDocscontract without hiding the error or touching stored prices.
Generated by Claude Code
tombeckenham merged this264c5ad
tombeckenham closed this
Sign in to join this conversation.
Deploying with
Cloudflare Workers#
The latest updates on your project. Learn more about integrating Git with Workers.
View logs
Branch Preview URL