Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
adcec18
fix(backport): 输出前预算超时允许安全重试
Oct 14, 2026
fb7c86a
fix(backport): 保留 Claude 5.x 对话中系统指令以提高缓存命中
Oct 14, 2026
b681b99
wip(backport): 适配 Codex 图片直连及 JSON 流式响应
Oct 14, 2026
948bbb9
fix(backport): 修复 Codex 图片直连在 lite 的嵌入构建兼容性
Oct 14, 2026
05d5e25
fix(backport): 移除 Codex 图片直连未使用函数
Oct 14, 2026
4e4e45d
fix(backport): Codex 图片直连按账号启用以兼容既有 Responses 路由
Oct 14, 2026
3e39840
test(backport): 补充 Codex 原生图片 JSON 解析及计费用量回归
Oct 14, 2026
72f2d7a
test(grok): 消除模型列表后台同步引起的额度测试竞态
Oct 15, 2026
b3f2974
ci: 重新触发 Grok 回归修复的完整检查
Oct 15, 2026
3b45fb3
ci: 支持按开发分支手动执行完整验证
Oct 15, 2026
1b5126c
merge(lite): 同步已合入的 PR30 并保留 Haiku 内联系统指令兼容
Oct 15, 2026
1e5c6c5
feat(gemini): 回移显式缓存核心服务和持久化绑定
Oct 15, 2026
848315e
fix(gemini): 接入缓存资源错误与绑定请求的重试隔离
Oct 15, 2026
df6f587
feat(gemini): 接通显式缓存管理、固定账号引用和原子计费
Oct 15, 2026
044fcea
fix(backport): 修复缓存启动验收并补齐图片直连协议回归
Oct 15, 2026
a65c6f2
fix(gemini): 修复CI静态检查与缓存集成测试数据污染
Oct 15, 2026
ce93b20
test(frontend): 修复模型预设测试遗漏导入并纳入完整CI
Oct 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -75,6 +76,14 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Frontend typecheck and critical vitest
run: make test-frontend
# Critical-only validation missed a missing import in the model preset tests.
# Keep the existing lint/typecheck gate, and execute every frontend suite.
- name: Full frontend Vitest suite
working-directory: frontend
run: pnpm run test:run --maxWorkers=2 --minWorkers=1
- name: Frontend production build
working-directory: frontend
run: pnpm run build

golangci-lint:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Security Scan
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 3 * * 1'

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ docs/*
!docs/PAYMENT_CN.md
!docs/ADMIN_PAYMENT_INTEGRATION_API.md
!docs/ASYNC_IMAGE_TASKS.md
!docs/GEMINI_EXPLICIT_CACHE.md
!docs/CODEX_DIRECT_IMAGES.md
!docs/legal/
!docs/legal/*.md
.serena/
Expand Down
7 changes: 7 additions & 0 deletions backend/cmd/server/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func provideCleanup(
oauth *service.OAuthService,
openaiOAuth *service.OpenAIOAuthService,
geminiOAuth *service.GeminiOAuthService,
geminiCachedContent *service.GeminiCachedContentService,
antigravityOAuth *service.AntigravityOAuthService,
grokOAuth *service.GrokOAuthService,
openAIGateway *service.OpenAIGatewayService,
Expand All @@ -111,6 +112,12 @@ func provideCleanup(

// 应用层清理步骤可并行执行,基础设施资源(Redis/Ent)最后按顺序关闭。
parallelSteps := []cleanupStep{
{"GeminiCachedContentService", func() error {
if geminiCachedContent != nil {
geminiCachedContent.Stop()
}
return nil
}},
{"OpsIngressRejectAggregator", func() error {
if opsIngressReject != nil {
opsIngressReject.Stop()
Expand Down
23 changes: 16 additions & 7 deletions backend/cmd/server/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/cmd/server/wire_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
oauthSvc,
openAIOAuthSvc,
geminiOAuthSvc,
service.NewGeminiCachedContentService(nil, nil, cfg),
antigravityOAuthSvc,
nil, // grokOAuth
nil, // openAIGateway
Expand Down
4 changes: 4 additions & 0 deletions backend/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,9 @@ type GatewayConfig struct {
ProxyProbeResponseReadMaxBytes int64 `mapstructure:"proxy_probe_response_read_max_bytes"`
// Gemini 上游响应头调试日志开关(默认关闭,避免高频日志开销)
GeminiDebugResponseHeaders bool `mapstructure:"gemini_debug_response_headers"`
// GeminiCachedContentMaxTTLSeconds bounds explicit-cache creation and renewal.
// Zero uses the safe 24-hour default; this does not enable cache API routes.
GeminiCachedContentMaxTTLSeconds int `mapstructure:"gemini_cached_content_max_ttl_seconds"`
// ConnectionPoolIsolation: 上游连接池隔离策略(proxy/account/account_proxy)
ConnectionPoolIsolation string `mapstructure:"connection_pool_isolation"`
// ForceCodexCLI: 强制将 OpenAI `/v1/responses` 请求按 Codex CLI 处理。
Expand Down Expand Up @@ -1964,6 +1967,7 @@ func setDefaults() {
viper.SetDefault("gateway.upstream_response_read_max_bytes", DefaultUpstreamResponseReadMaxBytes)
viper.SetDefault("gateway.proxy_probe_response_read_max_bytes", int64(1024*1024))
viper.SetDefault("gateway.gemini_debug_response_headers", false)
viper.SetDefault("gateway.gemini_cached_content_max_ttl_seconds", 86400)
viper.SetDefault("gateway.connection_pool_isolation", ConnectionPoolIsolationAccountProxy)
// HTTP 上游连接池配置(针对 5000+ 并发用户优化)
viper.SetDefault("gateway.max_idle_conns", 2560) // 最大空闲连接总数(高并发场景可调大)
Expand Down
3 changes: 3 additions & 0 deletions backend/internal/handler/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
EndpointVideosExtensions = "/v1/videos/extensions"
EndpointVideos = "/v1/videos"
EndpointGeminiModels = "/v1beta/models"
EndpointGeminiCachedContents = "/v1beta/cachedContents"
)

const EndpointAntigravityGenerateContent = "/v1internal:streamGenerateContent"
Expand Down Expand Up @@ -109,6 +110,8 @@ func NormalizeInboundEndpoint(path string) string {
return EndpointResponsesCompact
case strings.Contains(path, EndpointResponses) || isResponsesRootAliasPath(path):
return EndpointResponses
case isBareOrSubpathOf(path, EndpointGeminiCachedContents):
return EndpointGeminiCachedContents
case strings.Contains(path, EndpointGeminiModels):
return EndpointGeminiModels
default:
Expand Down
35 changes: 18 additions & 17 deletions backend/internal/handler/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,24 @@ var gatewayCompatibilityMetricsLogCounter atomic.Uint64

// GatewayHandler handles API gateway requests
type GatewayHandler struct {
gatewayService *service.GatewayService
openAIGatewayService *service.OpenAIGatewayService
geminiCompatService *service.GeminiMessagesCompatService
antigravityGatewayService *service.AntigravityGatewayService
userService *service.UserService
billingCacheService *service.BillingCacheService
usageService *service.UsageService
apiKeyService *service.APIKeyService
usageRecordWorkerPool *service.UsageRecordWorkerPool
errorPassthroughService *service.ErrorPassthroughService
securityAuditCoordinator *securityaudit.Coordinator
concurrencyHelper *ConcurrencyHelper
userMsgQueueHelper *UserMsgQueueHelper
maxAccountSwitches int
maxAccountSwitchesGemini int
cfg *config.Config
settingService *service.SettingService
geminiCachedContentService *service.GeminiCachedContentService
gatewayService *service.GatewayService
openAIGatewayService *service.OpenAIGatewayService
geminiCompatService *service.GeminiMessagesCompatService
antigravityGatewayService *service.AntigravityGatewayService
userService *service.UserService
billingCacheService *service.BillingCacheService
usageService *service.UsageService
apiKeyService *service.APIKeyService
usageRecordWorkerPool *service.UsageRecordWorkerPool
errorPassthroughService *service.ErrorPassthroughService
securityAuditCoordinator *securityaudit.Coordinator
concurrencyHelper *ConcurrencyHelper
userMsgQueueHelper *UserMsgQueueHelper
maxAccountSwitches int
maxAccountSwitchesGemini int
cfg *config.Config
settingService *service.SettingService
}

// NewGatewayHandler creates a new GatewayHandler
Expand Down
Loading
Loading