Commit Graph

168 Commits

Author SHA1 Message Date
fawney19
7fcb9e6292 feat(usage): record request origin metadata (#362)
Record client IP and User-Agent in usage request_metadata for local execution requests without adding schema, API, or table fields.

References #357 and supersedes #358.

Co-authored-by: RWDai <27391645+RWDai@users.noreply.github.com>
2026-04-30 11:26:56 +08:00
RWDai
2b5247b9a8 fix(data): repair request candidate epoch created_at (#343)
Co-authored-by: fawney19 <elky0401@gmail.com>
2026-04-30 09:23:21 +08:00
Entropy.Xu
4d59d518d1 fix: correct API key expiry and dashboard savings (#361) 2026-04-30 00:35:32 +08:00
fawney19
9e2faa7e5b Tighten local auth allow-list matching 2026-04-30 00:26:33 +08:00
fawney19
37392d8774 fix(ai): allow null OpenAI Responses error fields 2026-04-29 21:12:14 +08:00
fawney19
a16550249b fix: allow empty provider secrets to attempt requests 2026-04-29 18:55:52 +08:00
fawney19
e751289dfb Support per-format provider key auth 2026-04-29 15:46:50 +08:00
fawney19
07a319259b Normalize canonical API formats 2026-04-29 10:20:41 +08:00
fawney19
230e7d6259 Normalize management token prefixes 2026-04-28 19:46:38 +08:00
fawney19
70f747d406 Add shared OAuth flows 2026-04-28 15:46:21 +08:00
AAEE86
712b484bc8 fix(scheduler): 恢复正则模型映射作为上游模型 (#355)
保留 provider_model_mappings 的优先级选择逻辑,但恢复
GlobalModel model_mappings 正则命中后的行为:使用命中的
allowed_model 作为实际上游 mapped_model。

修复了 #354 请求绕过基于正则表达式的模型映射的问题
2026-04-28 10:36:50 +08:00
fawney19
0c9b5ddd77 Fix usage terminal state regression 2026-04-28 10:31:16 +08:00
fawney19
3f1abb6906 Format OAuth refresh consistency changes 2026-04-28 09:54:35 +08:00
fawney19
29fc0be121 Tighten OAuth refresh consistency 2026-04-28 09:36:42 +08:00
Kayphoon
5311eb0da1 Fix provider model mapping selection (#354) 2026-04-28 09:23:39 +08:00
fawney19
321f21ad49 Fix provider OAuth refresh token reuse 2026-04-28 02:00:35 +08:00
fawney19
6426b5d80e chore: add oauth refresh diagnostics 2026-04-28 00:18:51 +08:00
fawney19
05b8b8a442 fix: bypass oauth cache for forced refresh 2026-04-27 23:04:31 +08:00
fawney19
17f09fc8c1 Expose ranking metadata in request trace 2026-04-27 17:24:32 +08:00
fawney19
51c3beb614 Narrow core ranking public surface 2026-04-27 17:24:32 +08:00
fawney19
e9f03d8d29 Remove ranked minimal selection compatibility helper 2026-04-27 17:24:32 +08:00
fawney19
44930532dc Align ranked candidate selection test names 2026-04-27 17:24:32 +08:00
fawney19
f10f5f071d Clarify ranked minimal candidate selection 2026-04-27 17:24:32 +08:00
fawney19
2101a4ecc7 Drop legacy candidate ordering helpers 2026-04-27 17:24:31 +08:00
fawney19
a23758808d Isolate core candidate selection helpers 2026-04-27 17:24:31 +08:00
fawney19
91db4eefd0 Persist ranking metadata through request traces 2026-04-27 17:24:31 +08:00
fawney19
1d23bf4ecb Isolate standalone key wallet handling 2026-04-27 17:24:31 +08:00
fawney19
3b542434a2 Unify candidate ranking pipeline 2026-04-27 17:24:31 +08:00
Kayphoon
9b866a6d17 fix(auth): 修复独立密钥继承用户访问限制 (#347) 2026-04-27 12:32:21 +08:00
Entropy.Xu
6e1eaf8aec fix(kiro): 修复 Kiro WebSearch MCP 调用 (#344)
* fix(kiro): 接入 Kiro MCP web_search 工具调用

* fix(kiro): 对齐 Kiro IDE MCP 鉴权与 profileArn 头部

* fix(responses): 保留 Responses 嵌套与自定义工具参数

* test(ci): 通过 Rust Action 三项检查
2026-04-27 12:20:26 +08:00
fawney19
3991d47166 Fix format checks and local error messages 2026-04-27 00:27:03 +08:00
fawney19
0c73f245ab shrink formats conversion to compatibility facades 2026-04-26 23:59:53 +08:00
fawney19
989b27426b refactor formats adapters and matrix ownership 2026-04-26 23:59:53 +08:00
fawney19
c10cd8240e refactor ai formats registry adapters 2026-04-26 23:59:53 +08:00
fawney19
4ec591fbf2 centralize openai responses alias handling 2026-04-26 23:59:53 +08:00
fawney19
ea3dc3257e clean up legacy openai cli adapter names 2026-04-26 23:59:53 +08:00
fawney19
5b914aa78c migrate ai format conversion to responses adapters 2026-04-26 23:59:53 +08:00
fawney19
baa0ddd787 Improve runtime miss usage diagnostics 2026-04-26 01:44:54 +08:00
Entropy.Xu
d784c540b6 fix(kiro): 隐藏 OAuth 刷新重试流程 (#339) 2026-04-25 21:29:45 +08:00
fawney19
429fdb47e6 fix(usage): 简化本地执行错误提示 2026-04-25 20:46:22 +08:00
fawney19
912a92cd1a refactor(rules): 规则引擎容错优化,无效规则条目跳过而非中止整个规则集
- header/body rules 的 _are_locally_supported 简化为仅检查是否为数组
- apply 逻辑中遇到格式错误/不支持的规则条目改为 continue 跳过,而非 return false
- 允许非字符串 header value,自动序列化为 JSON 字符串
- 宽松处理无效 regex flag,不再拒绝整条规则

fix(gateway): Claude CLI 路由仅检查 bearer 头,不排斥同时携带 x-api-key 的请求

feat(observability): 监控链路候选展示解密 auth_config 的账号标签和 OAuth 计划类型
2026-04-25 19:46:52 +08:00
fawney19
00744c0ce5 feat(observability): 引入错误链路 error_flow 元数据并区分上游/客户端错误
- 网关在本地 failover 时构建 error_flow 元数据(分类/决策/传播策略),写入 report_context
- scheduler-core 解析并透传 error_flow 至候选 extra_data
- admin usage 详情拆分 request/upstream/client/failure_summary 错误域,敏感上游错误标记为 suppressed
- 前端 RequestDetailDrawer 拆出"返回客户端"与"上游响应"双错误卡片
- HorizontalRequestTimeline 节点详情展示真实请求错误及 error_flow 标签
2026-04-25 17:01:07 +08:00
Entropy.Xu
bb7fe9fe37 fix(kiro): 修复 Kiro OAuth 过期懒刷新 (#334)
* fix(kiro): 修复 OAuth 过期懒刷新

* fix(kiro): 修复 OAuth 过期懒刷新

* fix(scheduler): 修复 candidate extra data clippy 告警
2026-04-25 16:40:45 +08:00
fawney19
61e12e2c17 feat(scheduler): candidate report 携带 header_rules 与 body_rules
各 planner 在构造 report context 时附带端点的 header/body 改写规则,scheduler 解析后写入 candidate extra_data,便于追踪请求实际应用的透传规则
2026-04-25 11:43:53 +08:00
fawney19
e5bbc797e0 chore(gateway): 调小 Postgres 连接池默认值
- max_connections 100 → 20
- idle_timeout 60s → 30s
- .env.example 补充连接池相关变量注释
2026-04-25 09:53:21 +08:00
fawney19
f30b1f3f6b fix(usage): 流式终端 usage 以更完整值为准,Codex CLI 显式选择 response 解析器
- 新增 StandardizedUsage::signal_score/is_more_complete_than/choose_more_complete,流式合并与终端落库均按信号完整度择优
- OpenAI Chat/CLI 解析器支持仅 usage 的终结 chunk 与 response.completed usage
- Codex provider 注入 provider_stream_event_api_format=openai:cli,解析器选择改由 report_context 显式决定
- usage_mapper 扩展嵌套 response/message/item 兼容 Claude message_start/message_delta 及 Gemini stream chunks
- usage SQL upsert 在终态(completed/failed/cancelled)时按 GREATEST 写入 token/费用镜像列
2026-04-25 00:57:01 +08:00
fawney19
2c6209277f fix(usage): Claude 流式合并 message_start/delta usage,前端移动端缓存 token 合并展示
- Claude provider state 在 message_start 记录基础 usage,message_delta 合并 output_tokens
- 前端 UsageRecordsTable 移动端缓存列改为 cache_creation + cache_read 合计展示
2026-04-24 22:28:04 +08:00
fawney19
5b3593038d fix(usage): OpenAI 缺失 input_tokens 时从 total 回推
- 同步与流式两条路径均在 input_tokens 为 0 且 total > output 时用 total - output 兜底
- 补充对应单元测试
2026-04-24 22:08:23 +08:00
fawney19
db1059e73b fix(usage): 修复 Gemini total 重复累加 cache_read 并补充测试
- write.rs: Gemini usage 提取 total 时不再叠加 cachedContentTokenCount
- 补充 Claude 大 cache_read 场景下 input_tokens 不被扣减的测试
- 补充前端 getEffectiveInputTokens 对 Claude 格式不减 cache_read 的测试
2026-04-24 21:20:45 +08:00
fawney19
e265475c17 fix(usage): 修正 input_tokens 统计与显示
- SQL 查询不再用 settlement snapshot 的 billing_input_tokens 覆盖原始 input_tokens
- usage_mapper 针对 OpenAI 格式在 input_tokens 缺失时从 total_tokens - output_tokens 推导
- 前端轮询合并优先采用最新 record 的 input_tokens / effective_input_tokens
2026-04-24 20:59:12 +08:00