1. 14 Jan, 2026 4 commits
    • LLLLLLiulei's avatar
      feat: enhance proxy management · 9bdb45be
      LLLLLLiulei authored
      9bdb45be
    • ianshaw's avatar
      fix(网关): 修复账号选择中的调度器快照延迟问题 · 25b00abc
      ianshaw authored
      ## 问题描述
      调度器快照更新存在0.5-1秒的延迟(Outbox轮询间隔),导致在账号被限流或过载后的短时间窗口内,
      可能仍会被选中,造成请求失败。
      
      ## 根本原因
      账号选择逻辑依赖调度器快照(listSchedulableAccounts),但快照更新有延迟:
      - Outbox轮询: 每1秒检查一次变更事件
      - 全量重建: 每300秒重建一次
      - 时间窗口: 账号状态变更后0.5-1秒内,快照可能未更新
      
      ## 解决方案
      在账号选择循环中添加IsSchedulable()实时检查,作为第二道防线:
      1. 第一道防线: 调度器快照过滤(可能有延迟)
      2. 第二道防线: IsSchedulable()实时检查(本次修复)
      
      IsSchedulable()会检查:
      - RateLimitResetAt: 限流重置时间
      - OverloadUntil: 过载持续时间
      - TempUnschedulableUntil: 临时不可调度时间
      - Status: 账号状态
      - Schedulable: 可调度标志
      
      ## 修改范围
      ### OpenAI Gateway Service
      - SelectAccountForModelWithExclusions: 添加IsSchedulable()检查
      - SelectAccountWithLoadAwareness: 添加IsSchedulable()检查
      
      ### Gateway Service (Claude/Gemini/Antigravity)
      - 负载感知选择候选账号筛选: 添加IsSchedulable()检查
      - selectAccountForModelWithPlatform: 添加IsSchedulable()检查
      - selectAccountWithMixedScheduling: 添加IsSchedulable()检查
      
      ### 测试用例
      - OpenAI: 添加2个测试用例验证限流账号过滤
      - Gateway: 添加2个测试用例验证限流和过载账号过滤
      
      ### 其他修复
      - ops_repo_preagg.go: 修复platform为NULL时的聚合问题
      
      ## 测试结果
      所有单元测试通过 
      25b00abc
    • yangjianbo's avatar
    • yangjianbo's avatar
      fix(网关): OAuth 请求强制 store=false · 3663951d
      yangjianbo authored
      避免上游 Store 必须为 false 的错误
      
      仅在缺失或 true 时写回 store
      
      测试: go test ./internal/service -run TestApplyCodexOAuthTransform
      
      测试: make test-backend(golangci-lint 已单独执行)
      3663951d
  2. 13 Jan, 2026 5 commits
    • yangjianbo's avatar
      为类型断言补充 ok 校验并添加中文说明,避免 errcheck 报错(backend/internal/service/ · 7bbf49fd
      yangjianbo authored
          openai_codex_transform_test.go:36、backend/internal/service/
          openai_codex_transform_test.go:89、backend/internal/service/
          openai_codex_transform_test.go:104)。
      7bbf49fd
    • yangjianbo's avatar
      fix(网关): 修复工具续链校验与存储策略 · 70eaa450
      yangjianbo authored
      完善 function_call_output 续链校验与引用匹配
      续链场景强制 store=true,过滤 input 时避免副作用
      补充续链判断与过滤相关单元测试
      
      测试: go test ./...
      70eaa450
    • ianshaw's avatar
    • ianshaw's avatar
      fix(openai): 增强 OpenCode 兼容性和模型规范化 · 3d6e01a5
      ianshaw authored
      ## 主要改动
      
      1. **模型规范化扩展到所有账号**
         - 将 Codex 模型规范化(如 gpt-5-nano → gpt-5.1)应用到所有 OpenAI 账号类型
         - 不再仅限于 OAuth 非 CLI 请求
         - 解决 Codex CLI 使用 ChatGPT 账号时的模型兼容性问题
      
      2. **reasoning.effort 参数规范化**
         - 自动将 `minimal` 转换为 `none`
         - 解决 gpt-5.1 模型不支持 `minimal` 值的问题
      
      3. **Session/Conversation ID fallback 机制**
         - 从请求体多个字段提取 session_id/conversation_id
         - 优先级:prompt_cache_key → session_id → conversation_id → previous_response_id
         - 支持 Codex CLI 的会话保持
      
      4. **Tool Call ID fallback**
         - 当 call_id 为空时使用 id 字段作为 fallback
         - 确保 tool call 输出能正确匹配
         - 保留 item_reference 类型的 items
      
      5. **Header 优化**
         - 添加 conversation_id 到允许的 headers
         - 移除删除 session headers 的逻辑
      
      ## 相关 Issue
      - 参考 OpenCode issue #3118 关于 item_reference 的讨论
      3d6e01a5
    • IanShaw027's avatar
      fix(codex): 添加codex CLI instructions fallback机制 · f9713e87
      IanShaw027 authored
      ## 问题
      - 使用OpenAI API key时,opencode客户端可能因instructions不兼容而报错
      - 依赖外部GitHub获取instructions,网络故障时会失败
      
      ## 解决方案
      1. 将codex CLI标准instructions嵌入到项目中
      2. 实现自动fallback机制:
         - 优先使用opencode GitHub的instructions
         - 失败时自动fallback到本地codex CLI instructions
      3. 添加辅助函数用于错误检测和手动替换
      
      ## 改动
      - 新增: internal/service/prompts/codex_cli_instructions.md
        - 从codex项目复制的标准instructions
        - 使用go:embed嵌入到二进制文件
      
      - 修改: internal/service/openai_codex_transform.go
        - 添加embed支持
        - 增强getOpenCodeCodexHeader()的fallback逻辑
        - 新增GetCodexCLIInstructions()公开函数
        - 新增ReplaceWithCodexInstructions()用于手动替换
        - 新增IsInstructionError()用于错误检测
      
      ## 优势
      - 零停机:GitHub不可用时仍能正常工作
      - 离线可用:不依赖外部网络
      - 兼容性:使用标准codex CLI instructions
      - 部署简单:instructions嵌入到二进制文件
      f9713e87
  3. 12 Jan, 2026 27 commits
  4. 11 Jan, 2026 4 commits
    • IanShaw027's avatar
      fix(ci): 修复最后一批CI错误 · c48795a9
      IanShaw027 authored
      - 修复 ops_repo_trends.go 中剩余3处 Rows.Close 未检查错误
      - 修复 ops_settings.go, ops_settings_models.go, ops_trends.go 的格式化问题
      c48795a9
    • IanShaw027's avatar
      fix(ci): 修复剩余的CI错误 · 19b67e89
      IanShaw027 authored
      - 修复 ops_repo_latency_histogram_buckets.go 中另一个函数的 WriteString 未检查错误
      - 修复 ops_repo_request_details.go 和 ops_repo_trends.go 中的 Rows.Close 未检查错误
      - 修复 ops_alert_models.go, ops_cleanup_service.go, ops_request_details.go 的格式化问题
      - 移除 ops_retry.go 中未使用的 status 字段
      - 修复 maxTime 函数重复声明(将测试文件中的函数重命名为 testMaxTime)
      19b67e89
    • IanShaw027's avatar
      fix(ci): 修复所有CI失败问题 · f017fd97
      IanShaw027 authored
      - 修复 ops_ws_handler.go 代码格式问题
      - 修复所有未检查的错误返回值(Rows.Close 和 WriteString)
      - 更新 .golangci.yml 排除 ops 相关服务文件的 redis 导入检查
      f017fd97
    • IanShaw027's avatar
      fix(lint): 修复代码格式和未使用变量问题 · ce3336e3
      IanShaw027 authored
      - 修复 ops_ws_handler.go 中的代码格式和返回值
      - 移除 ops_repo_latency_histogram_buckets.go 中不必要的错误检查
      - 修复 api_contract_test.go 缩进并添加运维监控配置项测试
      - 移除 ops_cleanup_service.go 中未使用的变量
      - 添加 ops_retry.go 中缺失的 status 字段
      ce3336e3