Repository navigation
test(mock-llm-server): gemini router 告警改为连续 streak 并忽略无 marker 请求 - #2630
Merged
Merged
Conversation
#2619 复审 P2(随 squash 合入后跟进):geminiRouterHits 只在 router 分支 自增、主模型分支从不重置,告警判据实际是「该 marker 累计问过 router >2 次」而非文案声称的「没有主模型调用」。正常多步回合(router→主模型→ router)以及无 ACK marker 的 generateJson 共用兜底桶都会误报,且 mock server 全跑道实例级共享、只增不清。 - functionCall/text 分支 delete(marker):主模型一旦应答即结束连续段 - router 分支仅在提取到真实 marker 时计数,无 marker 的标题/摘要 generateJson 请求不进任何桶 - 补 3 条真实 MockLlmServer 回归用例(functionCall 重置、text 重置、 无 marker 不告警),各守卫变异独立咬红 - 顺手落实复审 P3:buildGeminiShellEnvSnapshotFragment 对 marker 加 shell 引号安全字符集断言,不把注入安全押在 extractor 正则上,配测试 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 20:52
deepcoldy
pushed a commit
that referenced
this pull request
Oct 31, 2026
同步最新 master(#2585 回复页脚控制台入口、#2605 TraeX 额度池顺序续跑、 #2630、#2619、#2473、#2568 共 6 提交)。与本 PR 仅在四个 i18n/页面文件 交集(bot-defaults-page.tsx、dashboard/web/i18n.ts、i18n zh/en),均为 各自新增不同键的同段并存,git 自动合并无冲突:本 PR 的 sharedSandbox* / sandbox_advice.* 全套与 master 的 replyFooter / autoModelQuota* 键共存。 Co-Authored-By: Claude Code <[email protected]>
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 3bf0b36。
|
|
🚀 Released in v3.56.0 |
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.
背景
#2619 评审中发现的 P2,该 PR 已 squash 合入(3e6283675),此为跟进修复。
P2:
server.ts的geminiRouterHits只在wantsJsonVerdict(router)分支自增,functionCall/text分支从不重置,因此告警文案声称「hit N times without a main-model call」,实际判据是「该 marker 累计问过 router >2 次」。两个真实假阳性(用真实MockLlmServer复现):generateJson请求(标题/摘要)全落到兜底 keyACK-test-message-received,无死循环也告警;且 mock server 是跑道级实例、计数只增不清,多 bot 共用一个 server 时桶越攒越高。只影响诊断告警的可信度,不动
src/、不影响任何用例红绿。改动(test/helpers/mock-llm-server + 两个测试文件)
functionCall与text分支geminiRouterHits.delete(marker):主模型一旦应答,连续段结束;buildGeminiShellEnvSnapshotFragment对 marker 加 shell 引号安全字符集断言(/^[A-Za-z0-9_\-.:#@ ]*$/),不把注入安全押在 marker-extractor 将来不改正则,并配 1 条用例。未采纳的其余 P3(诊断值完整打进公开 CI 日志、单测共享 /tmp 路径、bun test 腿不含 helpers 目录):不阻断,留给后续按需处理。
验证
bun x tsc --noEmit0 错;bun run typecheck:test-mocks0 错;bun run test test/helpers/mock-llm-server/gemini-shell-env.test.ts test/mock-llm-server.test.ts:29/29 绿;bun test同文件 5/5 绿;🤖 Generated with Claude Code