fix(ops): 修复日志级别过滤并增强OpenAI错误诊断日志
- 移除 warn 级别下 access info 的强制入库补写,确保运行时日志级别真实生效 - 将 OpenAI fallback matched 与 passthrough 断流提示按需求降级为 info - 为 codex_cli_only 与 instructions required 场景补充请求诊断字段(含 User-Agent) - 出于安全考虑移除请求体预览,仅保留 request_body_size 与白名单头信息 - 新增/更新回归测试,覆盖 Forward 入口到日志落库链路
This commit is contained in:
@@ -33,3 +33,21 @@ func TestGetModelPricing_Gpt53CodexFallbackStillUsesGpt52Codex(t *testing.T) {
|
||||
got := svc.GetModelPricing("gpt-5.3-codex")
|
||||
require.Same(t, gpt52CodexPricing, got)
|
||||
}
|
||||
|
||||
func TestGetModelPricing_OpenAIFallbackMatchedLoggedAsInfo(t *testing.T) {
|
||||
logSink, restore := captureStructuredLog(t)
|
||||
defer restore()
|
||||
|
||||
gpt52CodexPricing := &LiteLLMModelPricing{InputCostPerToken: 2}
|
||||
svc := &PricingService{
|
||||
pricingData: map[string]*LiteLLMModelPricing{
|
||||
"gpt-5.2-codex": gpt52CodexPricing,
|
||||
},
|
||||
}
|
||||
|
||||
got := svc.GetModelPricing("gpt-5.3-codex")
|
||||
require.Same(t, gpt52CodexPricing, got)
|
||||
|
||||
require.True(t, logSink.ContainsMessageAtLevel("[Pricing] OpenAI fallback matched gpt-5.3-codex -> gpt-5.2-codex", "info"))
|
||||
require.False(t, logSink.ContainsMessageAtLevel("[Pricing] OpenAI fallback matched gpt-5.3-codex -> gpt-5.2-codex", "warn"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user