chore: upgrade CLIProxyAPI to v7.2.139

This commit is contained in:
chuan
2026-08-22 19:18:54 +08:00
parent 00f2da4a39
commit 25736099ee
7 changed files with 30 additions and 29 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
# CLIProxyAPI 宿主补丁
这里保存 billing 最初为 CLIProxyAPI `v7.2.133` 制作、已在 `v7.2.137` 重新验证的三项宿主修复。三项补丁都不改变计费规则或数据库结构,必须按下列顺序应用:
这里保存 billing 最初为 CLIProxyAPI `v7.2.133` 制作、已在 `v7.2.139` 重新验证的三项宿主修复。三项补丁都不改变计费规则或数据库结构,必须按下列顺序应用:
1. [`cli-proxy-api-usage-context.patch`](cli-proxy-api-usage-context.patch)
2. [`cli-proxy-api-usage-identity.patch`](cli-proxy-api-usage-identity.patch)
@@ -8,8 +8,8 @@
适用基线:
- CLIProxyAPI`v7.2.137`
- 提交:`85d2faddd17e6f4f8675a84ee28b131f702e8eaa`
- CLIProxyAPI`v7.2.139`
- 提交:`0a14eb70ce19fac1d114bcdb4a476d61adc819e2`
- Native ABI`1`
- 第二项补丁把 RPC schema 从 `3` 提升到 `4`
@@ -84,8 +84,8 @@ git -C .externals/CLIProxyAPI apply ../../patch/cli-proxy-api-request-lifecycle-
cd .externals/CLIProxyAPI
gofmt -w internal/pluginhost sdk/api/handlers sdk/cliproxy/usage sdk/pluginabi sdk/pluginapi
go test -race ./internal/pluginhost ./sdk/api/handlers ./sdk/cliproxy/usage -count=1
version=v7.2.137-dev
commit=85d2fadd
version=v7.2.139-dev
commit=0a14eb70
build_date="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
CGO_ENABLED=1 go build -buildvcs=false \
-ldflags="-s -w -X main.Version=$version -X main.Commit=$commit -X main.BuildDate=$build_date" \
@@ -129,7 +129,7 @@ billing 必须使用 RPC schema v4 重新构建;旧 billing 动态库会向下
- billing 全部测试、billing race 测试及 CLIProxyAPI 相关包 race 测试通过;
- schema v3 对照插件仍能正常注册,新增字段不会发送给旧 schema。
升级到 CLIProxyAPI `v7.2.137` / `85d2fadd` 后,三项补丁可从干净基线按顺序重放,补丁涉及的三个包及其 race 测试通过。宿主全仓测试中的 3 个 Claude 指纹失败和 2 个 `reviewedInPlaceByteWrites` 清单过期失败均已在未应用补丁的纯上游 `85d2fadd` 上原样复现,属于上游例外,详见 [`../docs/operations.md`](../docs/operations.md)。
升级到 CLIProxyAPI `v7.2.139` / `0a14eb70` 后,三项补丁可从干净基线按顺序重放,补丁涉及的三个包及其 race 测试通过。`usage-identity` 已适配上游插件 executor 的独立 `execCtx`,保留嵌套执行防重复统计逻辑。宿主全仓测试中的 3 个 Claude 指纹失败和 2 个 `reviewedInPlaceByteWrites` 清单过期失败均已在未应用补丁的纯上游 `0a14eb70` 上原样复现,属于上游例外,详见 [`../docs/operations.md`](../docs/operations.md)。
## 性能影响
+12 -12
View File
@@ -131,13 +131,13 @@ index 994bd33a..3cc7743e 100644
opts := coreexecutor.Options{
Stream: false,
Alt: alt,
@@ -177,6 +179,7 @@ func (h *BaseAPIHandler) executeWithPluginExecutor(ctx context.Context, entryPro
}
req, opts := h.pluginExecutorRequest(ctx, entryProtocol, responseProtocol, modelName, originalRequestedModel, rawJSON, alt, false, execOptions)
lifecycle := h.newRequestLifecycleTracker(ctx, entryProtocol, modelName, originalRequestedModel, false, opts.Metadata, execOptions.SkipInterceptorPluginID)
+ ctx = lifecycle.executionContext()
@@ -179,6 +181,7 @@ func (h *BaseAPIHandler) executeWithPluginExecutor(ctx context.Context, entryPro
execCtx, nestedTracker := withNestedExecutionTracker(ctx)
req, opts := h.pluginExecutorRequest(execCtx, entryProtocol, responseProtocol, modelName, originalRequestedModel, rawJSON, alt, false, execOptions)
lifecycle := h.newRequestLifecycleTracker(execCtx, entryProtocol, modelName, originalRequestedModel, false, opts.Metadata, execOptions.SkipInterceptorPluginID)
+ execCtx = lifecycle.executionContext()
var interceptErr *interfaces.ErrorMessage
req, opts, interceptErr = h.applyRequestInterceptorsBeforeAuth(ctx, entryProtocol, originalRequestedModel, lifecycle.requestID(), req, opts, execOptions.SkipInterceptorPluginID)
req, opts, interceptErr = h.applyRequestInterceptorsBeforeAuth(execCtx, entryProtocol, originalRequestedModel, lifecycle.requestID(), req, opts, execOptions.SkipInterceptorPluginID)
if interceptErr != nil {
@@ -211,6 +214,7 @@ func (h *BaseAPIHandler) countWithPluginExecutor(ctx context.Context, handlerTyp
}
@@ -209,13 +209,13 @@ diff --git a/sdk/api/handlers/handlers_stream.go b/sdk/api/handlers/handlers_str
index 9cceec54..dcdc08df 100644
--- a/sdk/api/handlers/handlers_stream.go
+++ b/sdk/api/handlers/handlers_stream.go
@@ -41,6 +41,7 @@ func (h *BaseAPIHandler) streamWithPluginExecutor(ctx context.Context, entryProt
}
req, opts := h.pluginExecutorRequest(ctx, entryProtocol, responseProtocol, modelName, originalRequestedModel, rawJSON, alt, true, execOptions)
lifecycle := h.newRequestLifecycleTracker(ctx, entryProtocol, modelName, originalRequestedModel, true, opts.Metadata, execOptions.SkipInterceptorPluginID)
+ ctx = lifecycle.executionContext()
@@ -43,6 +43,7 @@ func (h *BaseAPIHandler) streamWithPluginExecutor(ctx context.Context, entryProt
execCtx, nestedTracker := withNestedExecutionTracker(ctx)
req, opts := h.pluginExecutorRequest(execCtx, entryProtocol, responseProtocol, modelName, originalRequestedModel, rawJSON, alt, true, execOptions)
lifecycle := h.newRequestLifecycleTracker(execCtx, entryProtocol, modelName, originalRequestedModel, true, opts.Metadata, execOptions.SkipInterceptorPluginID)
+ execCtx = lifecycle.executionContext()
var interceptErr *interfaces.ErrorMessage
req, opts, interceptErr = h.applyRequestInterceptorsBeforeAuth(ctx, entryProtocol, originalRequestedModel, lifecycle.requestID(), req, opts, execOptions.SkipInterceptorPluginID)
req, opts, interceptErr = h.applyRequestInterceptorsBeforeAuth(execCtx, entryProtocol, originalRequestedModel, lifecycle.requestID(), req, opts, execOptions.SkipInterceptorPluginID)
if interceptErr != nil {
@@ -305,6 +306,7 @@ func (h *BaseAPIHandler) executeStreamWithAuthManagerFormats(ctx context.Context
}