fix(router): 配置审查加载不出来 + benchmark query 噪声过滤 - #130
Open
ganisback wants to merge 2 commits into
Open
Conversation
RouterV2ProfileReview used summary.savings!.toFixed(6) with a non-null assertion, but the backend tags Savings/SavingsFraction with json:"...,omitempty". When routed cost equals baseline cost (collapsed to a single member), Savings is 0 and omitted from the JSON, so the field is undefined at runtime and undefined.toFixed throws "Cannot read properties of undefined (reading 'toFixed')". The Preact component crashes and the "配置审查" (profile review) tab renders blank. Use (summary.savings ?? 0).toFixed(6) so a zero/missing savings shows 0.000000 instead of crashing. savings_fraction was already guarded with || 0; the cost fields are safe because they sit behind the knownComparableCost branch which checks cost_known first. Verified by driving the UI via CDP: the profile tab now renders fully with 0 exceptions, including the previously crashing "预估已知节省 0.000000 ¥ (0.0%)" card. Generated with AI Co-Authored-By: csglite <xzhgan@gmail.com>
Pulls in agent-noise filtering in benchmark query curation (OpenCSGs/semantic-router v0.2.0), which prevents coding-agent tool/system turns (<task-notification>, <system-reminder>, etc.) from being selected as the routing query and collapsing calibration onto a single task family. Generated with AI Co-Authored-By: csglite <xzhgan@gmail.com>
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.
改动
两个相关修复,都针对 pool 优化路由:
1. 配置审查加载不出来(toFixed 崩溃)
RouterV2ProfileReview用summary.savings!.toFixed(6)非空断言,但后端Savings字段带json:"...,omitempty"。collapsed 到单成员的 profile 里Savings=0被省略,前端拿到undefined,undefined.toFixed抛 TypeError,Preact 组件崩溃 → 配置审查空白。改为
(summary.savings ?? 0).toFixed(6)。2. benchmark query 噪声过滤(依赖升级)
升级
semantic-routerv0.1.0 → v0.2.0。新版本在 curation 时过滤 coding agent 注入的 user-role 噪声 turn(<task-notification>/<system-reminder>/<tool-use-id>等),只取真实用户意图做 routing query 和 embedding。之前 25 条评估 query 全是同一任务(llama.cpp 升级)的工具通知片段,导致校准塌缩到单成员。过滤后 128 条历史请求产出 53 个 distinct 真实 query。
验证
go build+golangci-lint通过关联
Generated with AI