Moves live fact probing from committed record files into the Worker and D1. A probed value is now only ever something the Worker received itself.
Table (migration 0022_probe_observations, additive, chains from 0021)#
probe_observations: id, run_id, provider_id (FK providers, cascade), raw_id, route, fact, value (JSON, null when the response stated nothing), status, message (the provider's error text, the evidence; or the undecided reason), observed_at. Index on (provider_id, raw_id, fact). Append-only: the code only inserts, never updates or deletes.
When it probes#
Its own cron firing, PROBE_CRON = '7 * * * *' (hourly at :07, after the :00 models poll), wired like the FAL and Vercel extract crons so it never shares the 15-minute poll's budget. observed_at is the firing's scheduled time. Each invocation plans, in order:
- confirm: the newest attempt was decided but is not yet served, and is at least
PROBE_RUN_GAP_SECONDS (3600, one cron interval) old. First, so a long new backlog can never starve it; it is bounded by the count of decided, unserved values;
- new: a live chat row of an enabled provider, bound to exactly the probe's route, whose probeable fact is empty and has no observation at all;
- reverify: the newest attempt is
REVERIFY_AFTER_DAYS = 7 days old, oldest first. An undecided fact is re-tried weekly only while the row still lacks it.
New candidates rotate across providers. Whatever does not fit is the backlog for the next invocation. A failure part way (D1, say) is logged, reported as ingest_failed with job probe, and rethrown; the rest of the plan is the next firing's backlog.
Budgets (enforced in code, tested)#
PROBE_REQUEST_BUDGET = 12 requests per invocation across all providers, PROBE_PROVIDER_BUDGET = 4 per provider. Each request is a one-word prompt, streamed, max_tokens: 1 on every check but limits, 20 s timeout. Only checks a rule reads in that provider's wording are sent (below), so every request is an expected 400 or 422.
Serving rule#
A value is served only when the two newest decided observations, at least one cron interval apart (PROBE_RUN_GAP_SECONDS), agree; two overlapping invocations of one firing therefore never count as two runs. One observation is stored, not served. A later disagreeing observation stops it being served (logged as disagreement) until two newer ones agree. The poll loads the served facts once per probe-enabled provider and fills only an empty fact on the exact provider, model and route observed (withProbedFacts; docs win). Served as probe-verified with verifiedAt = the newer agreeing observation's date and sourceUrl = the endpoint probed. staleProbes on /v1/status counts served facts older than 90 days from the table (plus the legacy OpenCode Go records). No served shape change.
Classifier#
Unchanged: classifyProbeResponse and its fixtures of real bodies. Only an explicit 400/422 in a recognised wording decides; 2xx, timeout, auth, 402, 429, 5xx and unread 400s record no value. reasoning.mandatory only with mandatoryRule. Key redaction kept and extended to the key's leading 8 and trailing 6 characters.
Providers enabled#
Each provider lists its checks, and only checks a rule reads in its own wording, shown by a captured fixture:
Not enabled#
- cerebras, deepseek, fireworks, together, moonshot, novita, sambanova, hyperbolic, grok (xAI), dashscope, baseten: no rule reads their wording yet. The fixtures show Fireworks, Together and xAI answer the oversized
limits check with a 200, a billed completion nothing can read. Each is added later in its own PR.
- llmgateway: a gateway. No captured response shows a 400 in LLM Gateway's own wording rather than one forwarded from the upstream, so it is listed with
gateway: true and no checks, and the cron skips it. Its secret name is assumed to be LLMGATEWAY_API_KEY (LLMGATEWAY_KEY_SECRET, one constant).
- openrouter, vercel, huggingface, lovable, opencode, Cloudflare AI Gateway: gateways or resellers; not listed.
- perplexity: its rows bind
v1/agent, not chat/completions.
- opencode-go: the Worker holds no OPENCODE_GO_API_KEY.
Adding a provider#
- Add its entry with the checks to try and run the read-only dry run,
pnpm run probe -- <provider> <rawId...>, to capture real responses.
- Add a rule to
classifyProbeResponse for its own wording and the body to fixtures/probe-responses.json.
- List only the checks that decide. Never list a check the provider answers with a 2xx.
Removed#
src/server/providers/probes/records/groq.ts and probes/groq.ts. The Groq facts are not imported: the cron re-observes them (Groq is enabled and its rows have empty facts with no observation, so they are first in line).
.source/workflows/probe.ts (the weekly PR job).
scripts/probe.ts --write and mergeProbedRecords/bumpVerifiedAt. The script is now a read-only dry run: pnpm run probe -- <provider> <rawId...> prints what each check would observe and writes nothing.
Legacy path kept: OpenCode Go route records#
probes/opencode-go.ts (hand-written, 2026-10-23) still binds inference/go/google/v1beta/models/gemini-4-argon-contributor:generateContent and :streamGenerateContent on opencode-go/gemini-4-argon-contributor (opencode-catalog), lets the spec sync keep those two routes (opencode-routes), and sets that row's trainsOnRequestData (opencode-go-facts). Removing them would unbind that row. go.mdx names only the base path with no method, so no docs read can replace them, and the Worker holds no OpenCode Go key to re-observe them. Left untouched and marked LEGACY; nothing re-dates them now, so from 2027-01-22 /v1/status counts them on staleProbes. Follow-up: a Worker-observed route probe.
Admin read#
GET /v1/admin/probes/{provider}[?model=<rawId>] with X-Admin-Key: every observation newest first with value, message, status, observedAt, runId and served. Read-only; there is no route that writes an observation. Excluded from agent capabilities like the other admin ops. Client gains listProbeObservations (changeset).
First week in production#
The migration creates the table on merge. Three providers, at most 4 requests each an hour: a ceiling of 12 an hour, 288 a day, while the backlog of chat rows with empty probeable facts drains (a few days at most), then confirm runs and the weekly re-verify, which is roughly one request per probed fact per week. Every request is an expected 400 or 422 with max_tokens: 1 or an immediate refusal, so cost is close to nil. Facts fill for Groq (maxOutput, replay, mandatory on gpt-oss), OpenAI (maxOutput where docs are silent, mandatory) and Mistral (replay).
The six Groq facts the deleted record file served go null on the first poll after deploy. Each comes back once it has a new observation and a confirm at least an hour later, then the next 15-minute poll writes it. Confirms run first, so the delay is set by how far down Groq's new backlog the two gpt-oss models sit at 4 requests an hour: at best about 1 h 20 min after the first :07 firing, more likely a few hours, within a day. I could not count production's Groq backlog from here. Watch job: probe / probe-run logs, or GET /v1/admin/probes/groq?model=openai/gpt-oss-20b.
Secrets the Worker needs#
OPENAI_API_KEY, GROQ_API_KEY, MISTRAL_API_KEY (all already typed). Any one absent in production is a logged skip. LLMGATEWAY_API_KEY is not read while llmgateway stays a gateway.
Tests#
src/server/ingest/probe-facts.worker.test.ts: first-appearance selection, per-invocation and per-provider caps with round robin, confirm planned before a 3 x 5 new backlog, an overlapping invocation sending nothing, agreeing observations served only a cron interval apart, one observation not served, two agreeing runs served as probe-verified, disagreement un-serves until two newer agree, docs value wins, exact route binding, missing-key skip, gateway skip, re-verify oldest first, stale count, no key in stored messages. Classifier tests keep the real captured bodies.
Summary by CodeRabbit#
- New Features
- Added an admin-only, read-only endpoint to view a provider’s probe observations, including evidence and whether each observation is currently served.
- Model facts can now be marked as probe-verified after two agreeing observations.
- Improvements
- Probe-verified facts are rechecked regularly, and stale-probe status now includes these facts.
- Documentation
- Updated API documentation to describe probe observations and verification behavior.
coderabbitai[bot](GitHub profile, opens in a new tab) reviewed
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
poll-models.ts:1116ffe7ed17-3b8a-4fa0-b144-29e6f882c892Reviewing files that changed from the base of the PR and between 26e51127e9014f6dc427f69ffb8c8db58c474487 and 616bc2ee6d2b710f4df23a7119737d7c424e3286.
packages/client/src/generated/index.tsis excluded by!**/generated/**packages/client/src/generated/sdk.gen.tsis excluded by!**/generated/**packages/client/src/generated/types.gen.tsis excluded by!**/generated/**.changeset/probes-in-d1.md.source/workflows/probe.tsCLAUDE.mddrizzle/0022_probe_observations.sqldrizzle/meta/0022_snapshot.jsondrizzle/meta/_journal.jsonopenapi.jsonscripts/probe.tssrc/db/schema.tssrc/lib/agent-auth.worker.test.tssrc/lib/auth.tssrc/routeTree.gen.tssrc/routes/v1/admin/probes.$provider.tssrc/server/ingest/ingest-signals.tssrc/server/ingest/poll-models.tssrc/server/ingest/poll-models.worker.test.tssrc/server/ingest/probe-facts.tssrc/server/ingest/probe-facts.worker.test.tssrc/server/openapi.tssrc/server/providers/probes/chat-completions.test.tssrc/server/providers/probes/chat-completions.tssrc/server/providers/probes/compare.tssrc/server/providers/probes/groq.tssrc/server/providers/probes/index.tssrc/server/providers/probes/opencode-go.tssrc/server/providers/probes/probes.test.tssrc/server/providers/probes/records/groq.tssrc/server/providers/probes/types.tssrc/server/status.tssrc/worker.tswrangler.jsoncIncluded review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.