Skip to content

release v0.9.1 - #1377

Merged
ding113 merged 277 commits into
mainfrom
dev
Aug 3, 2026
Merged

ding113 merged 277 commits into
mainfrom
dev

Conversation

@ding113

@ding113 ding113 commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Release Note

本次 Release Note 汇总 v0.8.10 至当前 dev 分支的用户可感知变化。同一新功能在发布前的后续完善与修正已合并到对应功能条目,不再重复列入 Bug 修复。

新增功能

  • 新增有界供应商 Discovery:管理员可在系统设置中启用并配置分轮探测、并发数、Sticky SLA、总超时和冷却时间。流式请求会在受控窗口内比较多个候选,优先选择响应及时且优先级更高的有效结果,并在异常时保留 fallback。使用日志新增完整路由轨迹,可查看每轮尝试、最终供应商、失败原因和路由结果。
  • 新增请求 Replay:相同请求并发到达或断线重连时,可跟随正在生成的响应或复用已完成结果,减少重复调用上游供应商。使用日志支持筛选 Replay 请求,并明确标记由 Replay 直接服务的记录。
  • 新增流式内容门控:流式响应会等待首个有效内容后再提交给客户端;在此之前遇到错误帧、空流、静默超时或不完整响应时,会继续切换到可用供应商。系统设置支持关闭、影子和启用三种模式。
  • 新增最长前缀亲和与缓存效果观测:系统可根据对话内容的最长公共前缀,优先选择此前处理过相同上下文的供应商,提高 Prompt Cache 的复用机会。使用日志会展示亲和命中信息,供应商排行榜新增“缓存系数”;缓存效果数据仅用于观测,不会直接改变路由结果。
  • 使用日志新增“思考强度”:统一展示 Codex reasoning.effort 与 Anthropic output_config.effort,并标识供应商配置是否覆写了客户端请求;供应商设置同时新增 max 最高强度选项。
  • 升级 Session 监控与日志关联:按前缀亲和身份聚合同一会话,支持通过客户端来源 Session ID 或内部 Session ID 搜索,并可查看同一会话关联的多个来源 Session,减少会话监控与使用日志之间的信息偏差。
  • 实时显示参与请求的上游供应商:使用日志在供应商竞速和 fallback 期间可同时显示当前活跃的多个上游供应商,悬停后可查看完整列表。

Bug 修复

  • 修正 TTFB、TTFT 和输出速率口径:使用日志现在分别展示首字节时间和首 Token 时间,延迟详情新增分段展示;排行榜、公开状态页和 TPS/输出速率统一使用正确口径,避免旧版混合指标导致数值偏高或含义不清。
  • 完善供应商故障切换:能够正确识别 Responses 假成功或失败流、上游服务错误、容量不足、当前供应商缺少指定模型,以及结构化流未正确结束等情况,并继续切换到其他可用供应商,减少错误响应直接返回给客户端。
  • 修复 Codex 图片生成开关兼容性:供应商强制关闭图片生成时,现在也能识别并移除新版 image_gen namespace 工具,避免请求仍被转发到不支持图片生成的上游。
  • 修复 Codex 模型列表回退:上游未提供标准模型列表时,可回退读取 Codex manifest,并正确处理缓存校验与显式格式设置,避免模型列表为空。
  • 修复 Claude Code count_tokens 请求识别:缺少 metadata.user_id 的 Token 计数请求仍可被正确识别为 Claude Code,避免被供应商客户端限制误拦截。
  • 修复 Gemini Function ID 兼容性:完善带 JSON 转义内容的错误识别,确保 Vertex AI 因 functionCall 或 functionResponse 的 id 字段拒绝请求时,能够正确清理并重试。
  • 修复 OpenAI 缓存 Token 统计:正确记录 cache_write_tokens,并修正普通输入、缓存读取和缓存写入 Token 的拆分,避免使用日志和费用统计出现漏记或重复计算。
  • 修复供应商分组计费与保存:计费会应用 API Key 或用户实际匹配到的供应商分组倍率;仅修改 API Key 的其他字段时,也不会再意外清空供应商分组。
  • 修复供应商批量修改与撤销的一致性:进程中断、并发修改或撤销过期时,不再出现部分供应商已修改、部分未修改的状态;撤销后相关端点配置也会正确同步。
  • 修复 Responses WebSocket 请求取消:客户端在上游握手期间取消请求时,连接会及时结束,避免请求长时间悬挂。
  • 修复部分页面按钮的客户端交互边界:避免共享按钮组件跨 React Server Component 边界使用时出现无法正常交互的问题。

体验优化

  • 提升高并发和慢连接场景的稳定性:改善数据库、Redis、流式响应和后台写入之间的资源隔离与背压处理,减少慢客户端或依赖短暂卡顿造成的内存累积、请求完成后误报失败,以及状态或计费记录遗漏。
  • 增强网关运行状态的可观测性:日志详情集中展示 Discovery、Replay、最长前缀亲和、流式内容门控和供应商链路信息,便于快速判断请求为何选择某个供应商、是否发生 fallback,以及响应是否由 Replay 服务。
  • 支持动态调整网关能力:Replay 和缓存效果观测可从系统设置中启用或关闭,无需修改环境变量或重新部署;未显式设置时仍沿用部署环境的默认配置。

其他杂项

  • 产品品牌更新为 CC Hub:登录页、实时数据大屏、公开状态页、默认站点标题和文档已统一更新,并补充与 Anthropic 无关联的商标免责声明;已有自定义站点标题不会被覆盖,短屏和多语言环境下的免责声明布局也同步优化。
  • 供应商端点探测可按需关闭:部署管理员可通过 ENDPOINT_PROBE_SCHEDULER_ENABLED=false 完全关闭后台定时探测,默认行为保持不变。

ding113 added 3 commits August 2, 2026 20:49
Anchors session detail lookups, origin chain queries, and termination
cleanup to the immutable key owner of each request rather than the
session-level canonical identity. This prevents cross-owner data
leakage when multiple API keys share a physical session ID.

- resolveSessionRequestLocator now resolves directly by requestId
  when provided, returning canonicalSessionId, keyId, and userId so
  callers can scope all downstream reads to the request owner
- findSessionOriginChain queries by requestId and keyId, selecting the
  nearest initial-selection provider chain within the same key epoch
  instead of the first request in the session
- getNextRequestSequence uses an atomic Lua script to PERSIST the
  sequence key and write the owner marker in a single round trip
- storeSessionResponse, storeSessionResponseHeaders,
  storeSessionUpstreamResponseMeta, and phase snapshot methods now
  accept and refresh the keyId owner marker, keeping late-arriving
  response artifacts readable
- getSessionDetails and hasSessionMessages resolve the locator before
  loading stats when a requestId is supplied, then use the locator's
  userId for all subsequent queries; Redis-backed artifacts are skipped
  (returning null) when the owner marker is missing instead of failing
  closed, while database-backed audit data is still returned
- terminateResolvedSessionIdentity now always calls
  terminateObservedSession and returns sourceSessionIds so the caller
  can invalidate detail caches for every physical alias
- terminateSession fails closed when the owner key lookup throws with
  an expected keyId, preventing unauthorized cleanup
- Scoped getSessionMessages and getSessionResponse no longer fall
  through to legacy unscoped keys when the per-request key is absent
Add sessionIdentityKind and sessionFingerprint to each
setSessionDetailsCache fixture so the cached session details
satisfy the canonical identity contract enforced by the cache
layer.
…served lookups

Reserved session identities with an ownerUserId now also match
message_request rows whose session_identity is null but whose
session_id equals the queried identity. This supports legacy
physical session ids that use reserved prefixes.

The fallback is only added when ownerUserId is present so that
unscoped canonical lookups remain narrow and do not pick up
unrelated null-identity rows.
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧪 测试结果

测试类型 状态
代码质量 ✅
单元测试 ✅
集成测试 ✅
API 测试 ✅

总体结果: ✅ 所有测试通过

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9a894d1b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +159 to +161
`cch:replay:owner:${replayId}`,
`cch:replay:meta:${replayId}`,
`cch:replay:chunks:${replayId}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Replay Lua keys in one Redis Cluster slot

On Redis Cluster deployments, these differently prefixed owner, metadata, and chunk keys have no shared hash tag and normally map to different slots, so this three-key EVAL fails with CROSSSLOT. The exception is converted to null, which makes ReplaySpool.bootstrap() disable the spool; consequently Replay never records responses on cluster-backed installations. Apply a common hash tag derived from replayId to every key used by the multi-key Replay scripts, including completion and abort.

Useful? React with 👍 / 👎.

Comment on lines +6573 to +6576
const runtime = attempt.session as ProxySessionWithAttemptRuntime;
attempt.responseController = runtime.responseController ?? null;
attempt.clearResponseTimeout = runtime.clearResponseTimeout ?? null;
attempt.releaseAgent = runtime.releaseAgent ?? null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep per-attempt transport callbacks off the shared session

When Discovery is enabled and an alternative wins while the original attempt's doForward() continuation is still pending, syncWinningAttemptSession() overwrites the original session's transport callbacks with the winner's callbacks. The late loser continuation then reads those winner callbacks here, and cleanupAttempt() can release the winner's agent and remove its client-abort wiring while leaking the original attempt's agent reference. Capture the transport callbacks in attempt-local state before winner synchronization instead of rereading the mutable parent session.

Useful? React with 👍 / 👎.

Comment on lines +172 to +175
void this.store
.renewOwnerLease(this.identity.replayId, this.ownerToken)
.then((leaseHeld) => {
if (!leaseHeld && !this.released) this.halt("owner_lease_lost");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Refresh Replay metadata during owner heartbeats

When live Replay deduplication is enabled and an upstream emits no bytes for more than 30 seconds, this timer renews only the owner lease while ReplayMeta.heartbeatAt remains unchanged. Both tryServe() and an attached reader's stall check use that metadata timestamp, so new identical requests cannot attach and then execute upstream after their claim fails against the renewed lease, while existing attached streams terminate as stalled even though the owner is healthy. Perform a fenced metadata heartbeat alongside the lease renewal.

Useful? React with 👍 / 👎.

ding113 added 18 commits August 3, 2026 05:49
When persistCompleted detected an existing matching durable row or hit
a conflict during concurrent writes, the spool previously wrote an
aborted terminal state to the hot layer, masking the already-persisted
PG winner. persistCompleted now returns a discriminated result so the
spool can detect existing winners, and conflicts raise a dedicated
ReplayDurableConflictError. In both cases the spool calls the new
discardOwned method to silently drop the losing hot-layer candidate
without writing an aborted status. The sourceMessageRequestId check
was also relaxed from the persisted-row equality test so replays of
the same content from different source requests are accepted.
…ueues

Statistics resets previously wiped all Redis cost-cache keys including
the fixed 5h rolling windows, causing post-cutoff quota state to be
lost. A new prepareUserStatisticsResetFixed5h function atomically
deletes only the fixed 5h keys and records a monotonic cutoff
timestamp, and clearUserCostCache now accepts preserveFixed5hCostKeys
to skip those keys during the broader cleanup.

The reset queue now runs this preparation phase before enqueuing and
tracks a preparation version on the stored record so legacy queued
jobs are reconciled idempotently on retry. Enqueue failures after
preparation leave the record queued rather than discarding it, and
the next enqueue attempt recovers the prepared claim. Per-batch
deletion progress is persisted to the status store so retries
cumulate instead of restarting, and active-claim release errors no
longer mask the original business error code.
…code

Re-throwing the raw DOMException exposed browser-specific error text to
callers. Replace it with a stable FETCH_SESSIONS_CANCELLED error so
consumers can match on a known code regardless of the browser runtime.
The statistics-reset poll loop retried transient network errors
indefinitely at a fixed interval. Switch to exponential backoff with a
cap of five consecutive retryable failures, after which the reset is
marked failed instead of leaving the UI in a perpetual loading state.
Skip the failed-job handler when job data is missing recoverable fields
so undefined resetId or userId values do not corrupt status records.
Wrap status persistence in a try-catch so a transient store failure
still releases the active-reset claim and propagates the original
business error. Use optional chaining on job.opts for null safety.
getReadyRedis threw immediately when the shared client was in a
connecting state, causing spurious failures during startup or reconnect.
Make it async and await the ready or end event with a configurable
timeout so callers tolerate transient connection states.
When the Redis pipeline threw after some scan calls had already failed,
the returned errorCount omitted those earlier scan failures. Include
the accumulated scan error count so callers see the true failure total.
The 404 response for a not-found statistics reset leaked an
implementation-specific detail string. Use the shared
publicActionErrorDetail helper so the message matches other 404
responses across the API surface.
Replace the old behaviour of marking a reset as failed when polling
retries were exhausted: the authoritative server status is now
preserved and a recoverable error banner with a retry button is shown
instead. Each poll request is given a 15 s AbortSignal timeout so a
hung request no longer blocks subsequent retries.

Guard prepareUserStatisticsResetFixed5h against invalid or missing
Redis cutoff values by returning null instead of constructing an
epoch date.

Throw early when getResetQueue is called in development to prevent
accidental Bull/Redis processor creation outside production.

Add i18n strings for statusUnavailable and retryStatus across all
supported locales.
resetUserAllStatistics previously rejected requests with a
cold/unready Redis client when fixed 5h cost windows were active,
surfacing a CONNECTION_FAILED error before the job was even
enqueued. The reset queue itself already handles Redis readiness,
so this pre-enqueue guard was redundant and blocked otherwise
valid reset requests during cold-start windows.

The guard and its associated fixed-5h detection logic are removed;
the corresponding test now verifies that enqueue proceeds and the
queue receives the request without the action layer checking Redis
status.
Replace assertions that expected resetUserAllStatistics to fail with
CONNECTION_FAILED when Redis is unavailable. The reset now succeeds
and delegates fixed 5h readiness to the background queue via
enqueueUserStatisticsReset, so Redis is never contacted directly
during the action call.
…cal ledger rows

Reserved canonical identities (prefix-affinity or owner-scoped session
IDs) could match unrelated physical ledger rows via the session_id
fallback in the OR branch of the lookup condition. For reserved
identities the lookup now requires both the COALESCE expression and
the explicit session_identity column to match, preserving the
COALESCE expression index while avoiding aliasing.

The canonical lookup used by aggregateSessionStats and
aggregateMultipleSessionStats now also applies the stricter
reserved-identity condition so owner-scoped queries do not silently
pick up physical sessions that happen to share the same ID value.
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🧪 测试结果

测试类型 状态
代码质量 ✅
单元测试 ✅
集成测试 ✅
API 测试 ✅

总体结果: ✅ 所有测试通过

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

if (!result.written) {
if (result.retryable) {
unclaimPublicStatusFinalization(id);

P2 Badge Persist retryable public-status rollup writes

When Redis or the rollup write is transiently unavailable as a request reaches its terminal commit, this branch only removes the in-memory finalized marker. Nothing schedules the retained seed for another attempt, and the terminal database fence prevents that request from committing again, so the request is permanently absent from public availability, latency, and TPS statistics unless an unrelated duplicate finalization occurs. Put retryable events in a durable outbox or actively schedule their retry.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +68 to +70
`cch:user-statistics-reset:fixed5h:${input.resetId}`,
`user:${input.userId}:cost_5h_fixed`,
buildLeaseKey("user", input.userId, "5h", "fixed"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep reset-preparation keys in one Redis slot

On Redis Cluster deployments, every statistics reset reaches this preparation step, but the reset marker, user cost key, user lease key, and per-key entries have unrelated hash slots. Passing them together to the multi-key Lua script makes EVAL fail with CROSSSLOT, so enqueueUserStatisticsReset() returns an error before any reset job is queued. Use a shared hash tag or perform slot-local operations instead.

Useful? React with 👍 / 👎.

Comment on lines +383 to +386
local sequence = redis.call('INCR', KEYS[1])
redis.call('PERSIST', KEYS[1])
local ownerKey = ARGV[1] .. sequence .. ':owner'
redis.call('SETEX', ownerKey, ARGV[2], ARGV[3])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid constructing a second Redis key inside the sequence script

On Redis Cluster deployments, this script is routed using only KEYS[1], then dynamically accesses ownerKey derived from ARGV; that owner key generally belongs to another slot and Redis rejects it as a non-local key. Every request then enters the catch fallback and receives a timestamp/random sequence instead of an atomic increment, allowing concurrent requests to collide and overwrite request artifacts. Use co-slotted keys or issue the owner write separately.

Useful? React with 👍 / 👎.

Comment on lines +372 to +376
const requestedAt = await prepareUserStatisticsResetFixed5h({
resetId: jobData.resetId,
userId,
keyIds: jobData.fixed5hKeyIds ?? [],
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recover prepared resets without requiring another admin request

When fixed-window preparation succeeds but the subsequent Bull queue.add() definitively fails, this step has already deleted the user's and keys' fixed-5h cost and lease counters. The catch returns an error while retaining only a queued Redis record, and no background process scans such records, so unless an administrator manually submits the reset again the user receives a quota reset but the database statistics are never deleted. Enqueue before applying irreversible effects or schedule automatic reconciliation of prepared records.

Useful? React with 👍 / 👎.

Comment on lines +63 to +64
const lastWindowResult = await tx.execute(sql`
SELECT MAX(window_end) AS last_end FROM provider_cache_effectiveness

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Advance cache aggregation across empty windows

When an aggregation tick finds no requests with a cache compatibility key, the INSERT writes no rows, so this MAX(window_end) watermark never advances. On a busy deployment whose traffic is not cache-eligible, every five-minute tick consequently rescans the entire message_request interval since the initial lookback, and that interval grows without bound until a qualifying request arrives. Persist a separate watermark or an empty-window marker.

Useful? React with 👍 / 👎.

@ding113
ding113 merged commit 07fdc53 into main Aug 3, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Claude Code Hub Roadmap Aug 3, 2026
@railway-app
railway-app Bot temporarily deployed to proactive-celebration / production August 3, 2026 01:13 Inactive
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🧪 测试结果

测试类型 状态
代码质量 ✅
单元测试 ✅
集成测试 ✅
API 测试 ✅

总体结果: ✅ 所有测试通过

This branch was previously deployed

1 inactive deployment
proactive-celebration / production — 07fdc53e Deployed Aug 3, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants