Repository navigation
fix(logs): report the resolved upstream model in egress audit rows - #859
Closed
homniloquy wants to merge 1 commit into
Closed
homniloquy wants to merge 1 commit into
homniloquy wants to merge 1 commit into
Conversation
The log window's upstream-model column read ProxyRequest.model, which chat.ts fills with a *display* name: buildDisplayModelName() re-appends the -high / -fast suffixes parseModelName() had just stripped. Requests carrying a local suffix therefore advertised a model that was never requested upstream - gpt-6-high showed as gpt-6-astra-high while the wire saw gpt-6-astra. Route every egress audit row through upstreamModelOf(), which returns the resolved id the translation layer actually sent. No new suffix handling is introduced, so a model whose real id ends in an effort word is still reported verbatim. Ingress rows, the client-facing model echo, and reasoning-effort / fast-tier / routing behavior are unchanged. Refs icebear0828#848
4 tasks done
Collaborator
|
Superseded by merged PR #864, which reapplied this change on the current dev baseline and passed CI. |
This was referenced Oct 21, 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 / 概述
The dashboard log window's "upstream model" column rendered
ProxyRequest.model, whichchat.tsfills with a display name:buildDisplayModelName()re-appends the-high/-fastsuffixesparseModelName()had just stripped. A request forgpt-6-highwas therefore logged asgpt-6-astra-highwhile the wire actually carriedgpt-6-astra— the audit trail named a model that was never requested upstream.日志窗口的「出口模型」列读取的是
ProxyRequest.model,而该字段是chat.ts用buildDisplayModelName()生成的展示名——它会把parseModelName()刚剥掉的-high/-fast后缀重新拼回。于是gpt-6-high被记成gpt-6-astra-high,而实际请求上游的模型是gpt-6-astra,日志因此显示了一个从未真正请求过的模型。Changes / 改动
upstreamModelOf(), returning the resolved id the translation layer actually sent, and route every egress audit row through it — Codex account path, direct / fallback path, and the stream-close rows (client-abort, upstream-premature, client-write-failed). / 新增upstreamModelOf(),返回翻译层实际写出的模型 ID,并让所有出口审计行改走它——账号路径、直连/fallback 路径,以及 stream-close 各行。streamResponse()'smodelparameter conflated:modelstays the client-facing echo, a new optionalupstreamModelfeeds the audit rows (defaults tomodel, so the Ollama bridge caller is unaffected). / 拆分streamResponse()的model参数原先兼管的两种语义:model继续用于客户端回显,新增可选upstreamModel供审计行使用(缺省回落到model,Ollama 桥调用方无需改动)。tests/unit/routes/shared/direct-egress-model.test.tsdrivinghandleDirectRequest, plus resolver-driven cases inproxy-egress-log.test.ts; two pre-existing tests that asserted the old display-name behavior were corrected. / 回归覆盖:新增direct-egress-model.test.ts,并在proxy-egress-log.test.ts补充驱动真实解析器的用例;两个固化旧行为的既有测试一并修正。CHANGELOG.md. / 已记入CHANGELOG.md。Test Plan / 验证
npx tsc --noEmit— passed / 通过npm test— 325 files passed; 3423 tests passed, 1 skipped / 325 个文件通过、3423 项测试通过、1 项跳过npm run build— passed / 通过git diff --check— passed / 通过gpt-6-high/gpt-6-fast/gpt-6-astraall loggpt-6-astraon the egress row (matching the wire) while the ingress row keeps the raw name. / 实机端到端:对本地 mock 上游发起请求,出口行均显示gpt-6-astra(与线上一致),入口行保留原始名称。upstreamModelOf()to its old body turns the new cases red while the "no suffix" and "legitimate suffix" controls stay green. / 变异检查:改回旧实现后新增用例变红,两个对照用例仍为绿。npm run test:real— not run; the change is confined to audit logging undersrc/routes/shared/and does not touch the upstream protocol (translation/,proxy/,auth/). / 未运行:本次改动仅涉及审计日志,未触及上游协议层。Linked Issues / 关联 issue
Closes #848
This PR targets
devfor review and does not deploy or merge. / 本 PR 仅提交至dev供检查,未部署或合并。