feat(consensus): swap dead Kimi for NanoGPT + 48h stale-hide gate (L1) - #3172
Open
0motionguy wants to merge 1 commit into
Open
0motionguy wants to merge 1 commit into
0motionguy wants to merge 1 commit into
Conversation
The Kimi For Coding subscription stopped serving the consensus-analyst
worker reliably for server-side use, leaving 498 verdicts stale. Swap
the LLM provider to NanoGPT (Kimi-K2-Instruct via OpenAI-compatible
chat completions), keep Kimi as a fallback when only KIMI_API_KEY is
set, and tag the generator on the payload accordingly.
Hard rule alongside the swap: no publicly stale batches. Add a
48-hour TTL gate (CONSENSUS_MAX_AGE_HOURS, default 48) on the read
path — `getConsensusItemReport()` returns null past TTL and the new
`getFreshConsensusVerdictsPayload()` returns EMPTY rather than
rendering a stale ribbon. The public /consensus page now uses the
fresh-only accessor.
Worker (env, llm, fetcher):
- env.ts: add NANOGPT_API_KEY / NANOGPT_BASE_URL / NANOGPT_MODEL,
widen LLM_PROVIDER enum, add CONSENSUS_MAX_AGE_HOURS.
- consensus-analyst/llm.ts: rewrite client to prefer NanoGPT when
NANOGPT_API_KEY is set, fall back to Kimi (streamed, UA-gated)
otherwise. activeProvider() reports which path is live.
- consensus-analyst/index.ts: record provider + actual model on the
emitted payload (was hardcoded to KIMI_MODEL fallback).
- llm/router.ts (unrelated LLM router): widened enum required a
one-line narrow so 'nanogpt' falls back to 'kimi' in this router
(consensus-analyst has its own client; this router never serves it).
Web (selector + consumer):
- consensus-verdicts.ts: introduce ConsensusGenerator type, recognize
"nanogpt" on parse, add isConsensusPayloadFresh() +
getFreshConsensusVerdictsPayload().
- consensus/page.tsx: switch public consumer to fresh-only accessor.
- DailyVerdictPanel.tsx: widen prop type + label NanoGPT generator
("AI / NANOGPT KIMI-K2").
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KIMI_API_KEYis set.CONSENSUS_MAX_AGE_HOURS, default 48). NewgetFreshConsensusVerdictsPayload()returns EMPTY past TTL;getConsensusItemReport()returns null past TTL.Why now
Part of the ULTRA improvement plan derived from the deep-crawl harness shipped to toolbox in PR (pending). Phase 4 §4.1 always-ship row — L1 is independent of the deep-crawl deltas because Kimi is dead regardless of competitor evidence. The 48h stale-hide gate also implements the user-added hard rule: no publicly stale batches across TrendingRepo.
Files
Worker:
apps/trendingrepo-worker/src/lib/env.ts— add NANOGPT_API_KEY / NANOGPT_BASE_URL / NANOGPT_MODEL, widen LLM_PROVIDER enum, add CONSENSUS_MAX_AGE_HOURS.apps/trendingrepo-worker/src/fetchers/consensus-analyst/llm.ts— rewrite client (NanoGPT primary, Kimi fallback).activeProvider()reports active.apps/trendingrepo-worker/src/fetchers/consensus-analyst/index.ts— record actual provider + model on emitted payload (was hardcoded tokimi-k2-0711-preview).apps/trendingrepo-worker/src/lib/llm/router.ts— unrelated LLM router; narrowed to 'kimi'|'openrouter' after the enum widen (consensus-analyst doesn't use this router).Web (selector + consumer):
src/lib/consensus-verdicts.ts—ConsensusGeneratortype,isConsensusPayloadFresh(),getFreshConsensusVerdictsPayload().src/app/consensus/page.tsx— public consumer now uses fresh-only accessor.src/components/consensus/DailyVerdictPanel.tsx— widened prop type + new "AI / NANOGPT KIMI-K2" label.Test plan
pnpm --filter trendingrepo-worker tsc --noEmitcleanpnpm tsc --noEmitclean (existing.next/typeserrors unrelated)NANOGPT_API_KEYin worker prod env → run consensus-analyst fetcher → verifyconsensus-verdictspayload has"generator":"nanogpt"and"model":"moonshotai/Kimi-K2-Instruct"/consensuspage after fetcher publishes — Daily Verdict panel shows "AI / NANOGPT KIMI-K2"CONSENSUS_MAX_AGE_HOURS=0) → confirm homepage renders empty/degraded state, not a stale ribbonEvidence
Phase 4.1 always-ship row from the ULTRA improvement plan. Deep-crawl harness PR (pending) at
c:/dev/toolbox/scripts/competitor-deep-crawl/. The Kimi quota failure has been visible in the productionconsensus-verdictspayload (last computedAt ~Jun 1) since the LLM router stopped accepting User-Agentclaude-cli/1.0reliably.🤖 Generated with Claude Code