TrainLCD Jev rerank
A merged TrainLCD pull request that adds a typesafe noul to re-select which stations the AI chat suggests, wired into the request path but inert by default until a KV threshold arrives.
- Format
- Article
- Published by
- Community
- Last verified
- Oct 2026
Highlights
- The gap it closes: sanitizeSuggestions only checked that a suggested stationId existed in tool results, never whether it fit the request.
- The rerank sits in the runAgentTurn path but stays inert until agent_rerank_threshold appears in config:remote, so a merge changes nothing.
- Threshold handling is explicit: 0 < x <= 1 enables it, and strings, 0, values above 1 and non-finite input all fall back to disabled.
- It shares no code with the existing typesafe triage consumer even though both call the same API, because failure means retry rather than drop.
Watch out
The page is a merged pull request written in Japanese, and the captured text stops partway through the comparison table, so the review conversation and the diff itself are not here. What the description does establish: the AI chat at /agent/chat chooses its own suggested stations and sanitizeSuggestions only matches stationId against tool results, so existence is guaranteed but appropriateness is not checked, and there is no way to drop an unsuitable station or justify the ordering. The judgment is per candidate, selection is by probability order in selectSuggestions, and the reranked set is passed as a system message from prepareStep, with a rerank phase added to the agent.turn log. It is wired into the request path but produces no judgment and no request until agent_rerank_threshold is in config:remote, and behaviour at merge and deploy is stated to be identical to current. The threshold uses the same KV store as the ai_agent_enabled kill switch and the agent_daily_turn_limit cap, so it can be flipped without a deploy; there is deliberately no default value in code so an unmeasured number cannot reach production, and unknown config:remote keys are also delivered to the app, which is why this threshold appears in the app's settings fetch. Tests added are 33 cases in src/agent/rerank.test.ts and 8 in handler.test.ts, with a 20-item agent-rerank-eval.jsonl set and an offline src/cli/typesafe-rerank-spike.ts. Not documented in the capture: any accuracy, latency or cost figure, the prompt, which checkpoint or endpoint is called, the rerank half of the triage comparison table, and the rest of the review discussion. Copy reviewed against the linked page on 2026-10-04.
Questions about this entry
More Jev resources like this
From the Jev guides
Original write-ups on what this entry is for.
From the Jev community
Posts from builders shipping with Jev right now.