Skip to content

release v0.3.42#561

Merged
ding113 merged 35 commits intomainfrom
dev
Jan 7, 2026
Merged

release v0.3.42#561
ding113 merged 35 commits intomainfrom
dev

Conversation

@ding113
Copy link
Owner

@ding113 ding113 commented Jan 7, 2026

Summary

Release v0.3.42 consolidates major features, bug fixes, and refactors from the dev branch since v0.3.41. This release introduces provider query caching, Anthropic warmup interception, Codex provider-level parameter overrides with audit tracking, improved session details UX, and multiple quota/expiration bug fixes.

Highlights

New Features

Provider Query Cache (#554, #556)

  • Process-level memory cache with 30s TTL and Redis Pub/Sub cross-instance invalidation
  • Reduces database pressure under high-concurrency scenarios
  • Configurable via new system setting enableProviderCache (default: enabled)

Anthropic Warmup Request Interception (#525)

  • Optional system setting to intercept Anthropic warmup requests at proxy level
  • Eliminates unnecessary upstream API calls and output token costs
  • Logged with blocked_by=warmup and excluded from billing/statistics

Codex Provider-Level Parameter Overrides (#536)

Provider Override Audit Tracking (#557)

  • Records before/after values when provider-level settings override client parameters
  • Stored in Redis (5-min TTL) and Postgres (special_settings JSONB column)
  • New "Special Settings" tab in Session Details UI

Bug Fixes

Security/Pipeline Fixes

Quota & Rate Limit Fixes

UI/UX Fixes

Refactors

Dialog Component Refactor (#539)

Error Rules

Database Migrations

Migration Description
0044_uneven_donald_blake.sql Add intercept_anthropic_warmup_requests column
0045_mushy_human_torch.sql Add Codex override preference columns to providers
0046_woozy_dark_phoenix.sql Add provider total limit columns
0047_fix_system_settings_columns.sql Fix missing system_settings columns
0048_unknown_bushwacker.sql Add special_settings JSONB column
0049_shocking_ultimatum.sql Add enable_provider_cache system setting

Breaking Changes

None. All changes are backward compatible:

  • New database columns are nullable with sensible defaults
  • New features are opt-in via system settings
  • Refactored components maintain same external interfaces

Related Issues

Included PRs

PR Title
#557 feat: 审计并展示供应商级参数覆写(specialSettings)
#556 feat: 添加供应商缓存开关配置, 默认启用
#554 feat: 添加供应商查询缓存, 改善性能
#552 fix: ensure /v1/responses and /v1/chat/completions use GuardPipeline
#551 fix: add error rule for tool_use missing tool_result
#547 feat(error-rules): add Gemini non-streaming error rule
#546 fix: provider list not refreshing after adding new provider
#545 docs: fix Codex model config in usage-doc
#544 fix: add error rule for Codex reasoning effort mismatch
#539 refactor: 拆分 unified-edit-dialog 为专用对话框组件
#538 fix(ui): admin panel UI improvements
#537 fix: Session Messages 提升内容阈值并导出完整请求
#536 feat: Codex 供应商级覆写 reasoning/text/parallel_tool_calls
#535 fix: provider total limit editable + enforce + reset
#534 fix: Key 清除到期时间序列化更稳
#533 fix: 清除用户/Key 到期时间后保存不生效
#532 fix: 修复 my-usage 今日统计与只读 API 自助查询
#531 fix: 用户限额未设置时 Key 限额仍生效
#528 test(models): 为 available-models 工具函数添加单元测试
#527 fix: 修复 CodeRabbit webhook 反馈
#525 feat: 拦截 Anthropic Warmup 请求

Checklist

  • All included PRs merged to dev
  • Lint and typecheck pass
  • Tests pass
  • Build successful
  • Database migrations included

Description enhanced by Claude AI

ding113 and others added 30 commits January 4, 2026 11:32
* fix: my-usage stats and readonly usage API

* fix: bearer-only my-usage auth
* feat: add Codex provider-level overrides (#404)

* fix: align context1m default and tooltip provider scope

* chore(db): regenerate drizzle migration for codex provider overrides
* docs: fix Codex model config in usage-doc (#542)

* test: fix Biome formatting in system-config update test
Add new error rule to handle the case where a `tool_use` block is missing
its corresponding `tool_result` in the next message. This is the reverse
direction of the existing rule for `tool_result` missing `tool_use`.

The new pattern matches:
- `tool_use` ids were found without `tool_result` blocks immediately after
- Each `tool_use` block must have a corresponding `tool_result` block

Closes #550
* feat(error-rules): add Gemini non-streaming error rule

部分服务商仅支持流式的 gemini 请求, 这种情况下需要返回 400 状态码, 以便 gemini 检测到 generateContent 不可用时, 自动切换到 streamGenerateContent

Signed-off-by: Kevin Cui <bh@bugs.cc>

* fix: lint

Signed-off-by: Kevin Cui <bh@bugs.cc>

---------

Signed-off-by: Kevin Cui <bh@bugs.cc>
Move AddProviderDialog creation from Server Component (page.tsx) to
Client Component (ProviderManagerLoaderContent) to ensure useQueryClient()
correctly accesses the QueryClient instance within QueryClientProvider.

This fixes the issue where invalidateQueries() calls did not trigger
React Query to refetch data after adding a new provider.
* refactor: 拆分 unified-edit-dialog 为专用对话框组件 (#413)

将 1120 行的 unified-edit-dialog.tsx 拆分为 4 个单一职责组件:
- CreateUserDialog: 创建用户 + 首个密钥
- EditUserDialog: 编辑用户信息
- AddKeyDialog: 添加新密钥
- EditKeyDialog: 编辑单个密钥

主要改动:
- 提取共享逻辑到 hooks/ (翻译、模型建议)
- 提取工具函数到 utils/ (表单处理、provider group)
- 新增 getModelSuggestionsByProviderGroup action
- 修复 expiresAt 清除时传参问题 (使用空字符串)
- 添加单元测试覆盖新组件

BREAKING CHANGE: 删除 unified-edit-dialog.tsx,引用需更新为新组件

* fix: 为 Key Dialog 组件定义精确类型,消除 as any

- 新增 KeyDialogUserContext 类型,替代过于宽泛的 User 类型
- 移除 4 处 as any 类型断言
- 清理 key-list-header.tsx 中伪造的字段

Addresses Gemini Code Review feedback on type safety
…552)

* fix: ensure openai endpoints use GuardPipeline

* fix: avoid concurrent count mismatch on pipeline early return
- Add YesCode as fourth sponsor with logo
- Update Cubence discount from 20% to 10%
Remove custom X button, keep browser native clear button from
type="search".

- Remove custom clear button code and unused X icon import
- Remove unnecessary right padding (pr-9)
* feat: 添加供应商查询缓存, 改善性能

* fix: 让后台管理函数不经过缓存

* fix: 初始化 Redis 订阅时避免未正确设置 subscriptionInitialized
* feat: 添加供应商缓存开关配置, 默认启用

* refactor: 优化缓存开关读取方式, 避免热路径函数中频繁调用
- Redesign request list sidebar with minimized/expanded views
- Add icons to tabs and make tab list horizontally scrollable
- Add copy response button to session details
- Enhance code-display component with copy functionality
- Update storageTip i18n messages (zh-CN, en, ja, ru, zh-TW)
- Add new dashboard-main wrapper component
- Add session-stats component for request statistics
Add className prop support to CodeDisplayProps interface and apply it
to the component wrapper divs using cn() utility. This fixes the
TypeScript error where session-details-tabs.tsx was passing className
prop that didn't exist in the interface.

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20778497724

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@greptile-apps
Copy link

greptile-apps bot commented Jan 7, 2026

Skipped: This PR changes more files than the configured file change limit: (172 files found, 100 file limit)

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Too many files!

24 files out of 174 files are above the max files limit of 150.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Jan 7, 2026

Too many files changed for review.

1 similar comment
@greptile-apps
Copy link

greptile-apps bot commented Jan 7, 2026

Too many files changed for review.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ding113, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This release focuses on significant infrastructure and user interface improvements, enhancing the platform's ability to manage AI providers and user access. Key updates include expanded database capabilities for more detailed provider configuration and usage tracking, a complete overhaul of the user and API key management flows in the dashboard, and optimizations for handling specific API request types like Anthropic warmup probes. These changes aim to provide greater control, better performance, and a more intuitive administrative experience.

Highlights

  • Provider Caching Configuration: A new environment variable, ENABLE_PROVIDER_CACHE, has been added to .env.example to allow control over provider-level caching, enhancing performance.
  • Database Schema Enhancements: Several new Drizzle migrations introduce columns for total spend limits on providers (limit_total_usd), specific Codex override preferences (codex_reasoning_effort_preference, etc.), and a generic special_settings JSONB field for message requests. Idempotent migrations were also added to fix potential schema drift for system_settings columns.
  • Refined User and Key Management UI: New dialogs and forms have been implemented for creating users, adding keys, and editing both users and keys, providing a more streamlined and robust administrative experience. This includes improved handling of key expiration and provider group assignments.
  • Anthropic Warmup Request Interception: A new system setting, intercept_anthropic_warmup_requests, allows the application to directly respond to Claude Code warmup probes, preventing unnecessary calls to upstream providers and improving efficiency. These intercepted requests are logged but not billed or rate-limited.
  • Improved Backend Logic for Usage and Caching: Backend actions for active-sessions, keys, my-usage, and providers have been updated to support the new schema fields, exclude warmup requests from usage calculations, and include a new broadcastProviderCacheInvalidation mechanism for cross-instance cache coherence.
  • Documentation and Translation Updates: The CLAUDE.md file was refactored into a comprehensive developer guide, and various internationalization files were updated to support the new features and UI elements across multiple languages.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions bot added the size/XL Extra Large PR (> 1000 lines) label Jan 7, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request appears to be for release v0.3.42, containing a wide range of updates. This includes new features like provider caching, database schema migrations for new settings and limits, and significant refactoring of the UI for user and key management. I've identified a few areas for improvement, mainly concerning consistency in database migrations and data fetching to ensure robustness and prevent stale data. Overall, the changes are substantial and move the project forward.

I am having trouble creating individual review comments. Click here to see my feedback.

src/actions/providers.ts (3174)

high

The function getModelSuggestionsByProviderGroup uses findAllProviders(), which likely returns cached data. Other functions in this file that need fresh provider data were updated to use findAllProvidersFresh(). If a provider's allowedModels are updated, this function might return stale model suggestions until the cache expires. To ensure correctness, it should probably use findAllProvidersFresh() as well.

    const providers = await findAllProvidersFresh();

AGENTS.md (1)

medium

The content of this file is just the text "CLAUDE.md". This seems unintentional. If the goal was to point to CLAUDE.md, a symbolic link might be more appropriate, or this file might need different content. As it is, it will just render the plain text "CLAUDE.md".

drizzle/0049_shocking_ultimatum.sql (1)

medium

This migration is not idempotent. If it fails and is re-run, it will fail again. Other recent migration files in this PR, like 0047_fix_system_settings_columns.sql, use IF NOT EXISTS to ensure idempotency. It would be good to apply the same pattern here for consistency and robustness.

ALTER TABLE "message_request" ADD COLUMN IF NOT EXISTS "special_settings" jsonb;

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code Review Summary

This XL release PR (v0.3.42) introduces multiple new features and refactors across 173 files. The implementation demonstrates solid engineering practices with proper error handling, test coverage for new functionality, and backward-compatible database migrations.

PR Size: XL

  • Lines changed: 32,747 (27,778 additions + 4,969 deletions)
  • Files changed: 173

Split Recommendation: Given this is a release PR consolidating 25+ individual PRs that were already reviewed and merged to dev, the monolithic structure is acceptable. However, for future releases of this size, consider staged deployments or feature flagging.

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 0 0
Security 0 0 0 0
Error Handling 0 0 0 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Analysis Summary

Provider Cache Implementation (src/lib/cache/provider-cache.ts):

  • Solid design with 30s TTL, version tracking to prevent race conditions during concurrent refresh
  • Redis Pub/Sub for cross-instance invalidation with graceful degradation
  • Proper async initialization that doesn't block hot paths
  • CI/build environment detection to skip Redis subscription

Warmup Guard (src/app/v1/_lib/proxy/warmup-guard.ts):

  • Well-structured request detection with strict criteria
  • Proper audit logging with database persistence
  • Error handling logs failures without affecting the response

Guard Pipeline Refactor:

  • Chat completions handler correctly refactored to use GuardPipelineBuilder
  • Concurrent count tracking properly uses finally block for cleanup
  • Pipeline step reordering (sensitive before session, warmup added) follows logical design

Provider Selector Enhancements:

  • Cost limit checks added for session reuse path
  • Total cost limit enforcement with proper logging
  • Provider snapshot pattern maintains consistency during failover

Dialog Component Refactor:

  • Clean extraction of CreateUserDialog, EditUserDialog, AddKeyDialog, EditKeyDialog
  • Shared hooks (useKeyTranslations, useModelSuggestions, useUserTranslations) reduce duplication
  • Form utilities properly typed

Test Coverage:

  • New tests for warmup guard, chat completions handler guard pipeline, Codex provider overrides
  • Rate limit guard tests, provider selector total limit tests
  • UI component tests for provider form and user dialogs

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Proper logging throughout, no silent failures
  • Type safety - Clean, type annotations consistent
  • Documentation accuracy - Comments match implementation
  • Test coverage - Adequate for new features
  • Code clarity - Well-structured refactors

Automated review by Claude AI

<button
type="button"
className="text-muted-foreground hover:text-foreground transition-colors"
aria-label={`${label} - help`}
Copy link
Contributor

@github-actions github-actions bot Jan 7, 2026

Choose a reason for hiding this comment

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

[MEDIUM] [STANDARD-VIOLATION] Hardcoded English in aria-label breaks i18n

Why this is a problem: src/app/[locale]/settings/providers/_components/forms/provider-form.tsx:87 hardcodes an English suffix in an accessibility label:

aria-label={`${label} - help`}

This violates the project rule: CLAUDE.md:14 — “All user-facing strings must use i18n (5 languages supported). Never hardcode display text”. aria-label is user-facing via screen readers, so it should be localized.

Suggested fix:

<button
  type="button"
  className="text-muted-foreground hover:text-foreground transition-colors"
  aria-label={label}
>
  <Info className="h-4 w-4" />
</button>

try {
const session = await getSession();
if (!session || session.user.role !== "admin") {
return { ok: false, error: "无权限执行此操作" };
Copy link
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] [STANDARD-VIOLATION] Server action returns non-i18n error strings

Why this is a problem: src/actions/providers.ts:793 returns hardcoded Chinese error strings (also at src/actions/providers.ts:798, src/actions/providers.ts:806):

return { ok: false, error: "无权限执行此操作" };

This violates the project rule: CLAUDE.md:14 — “All user-facing strings must use i18n (5 languages supported). Never hardcode display text”. These ActionResult.error messages are displayed in UI toasts (e.g. src/app/[locale]/settings/providers/_components/provider-rich-list-item.tsx:274).

Suggested fix (server-side i18n + error codes):

import { getTranslations } from "next-intl/server";
import { ERROR_CODES } from "@/lib/utils/error-messages";

const tError = await getTranslations("errors");

if (!session || session.user.role !== "admin") {
  return {
    ok: false,
    error: tError("PERMISSION_DENIED"),
    errorCode: ERROR_CODES.PERMISSION_DENIED,
  };
}

if (!ok) {
  return {
    ok: false,
    error: tError("NOT_FOUND"),
    errorCode: ERROR_CODES.NOT_FOUND,
  };
}

@greptile-apps
Copy link

greptile-apps bot commented Jan 7, 2026

Too many files changed for review.

router.refresh();
} else {
toast.error(tList("resetUsageFailed"), {
description: res.error || tList("unknownError"),
Copy link
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] [STANDARD-VIOLATION] UI surfaces raw server error text (bypasses i18n)

Why this is a problem: src/app/[locale]/settings/providers/_components/provider-rich-list-item.tsx:274 displays ActionResult.error directly:

description: res.error || tList("unknownError"),

This can show non-localized strings (the new resetProviderTotalUsage action currently returns Chinese literals), violating CLAUDE.md:14 — “All user-facing strings must use i18n… Never hardcode display text”. It also makes it easy for other server actions to accidentally leak mixed-language or overly-internal messages.

Suggested fix: prefer errorCode translation when present.

import { getErrorMessage } from "@/lib/utils/error-messages";

const tErrors = useTranslations("errors");

// ...
const description = res.errorCode
  ? getErrorMessage(tErrors, res.errorCode, res.errorParams)
  : res.error || tList("unknownError");

toast.error(tList("resetUsageFailed"), { description });

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code Review Summary

This is an XL release PR combining core proxy/rate-limit behavior changes, provider caching/quota features, large UI refactors, DB migrations, and many new tests. The size makes it hard to validate regressions and increases rollback risk; please split by feature area before merging.

PR Size: XL

  • Lines changed: 32737
  • Files changed: 172
  • Split suggestions: (1) Warmup intercept + system settings + related UI/tests, (2) Provider total-limit + provider cache invalidation + related UI/tests, (3) Dashboard/user-management UI changes, (4) DB migrations + schema updates, (5) Documentation updates.

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 1 0
Security 0 0 0 0
Error Handling 0 0 2 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Critical Issues (Must Fix)

None.

High Priority Issues (Should Fix)

  1. [MEDIUM] [STANDARD-VIOLATION] Hardcoded English in accessibility label: src/app/[locale]/settings/providers/_components/forms/provider-form.tsx:87 (aria-label={${label} - help}) (Confidence: 80)
  2. [MEDIUM] [STANDARD-VIOLATION] New server action returns hardcoded, non-i18n error strings: src/actions/providers.ts:793 (Confidence: 85)
  3. [MEDIUM] [STANDARD-VIOLATION] UI surfaces raw ActionResult.error directly (bypasses i18n): src/app/[locale]/settings/providers/_components/provider-rich-list-item.tsx:274 (Confidence: 85)

Review Coverage

  • Logic and correctness
  • Security (OWASP Top 10)
  • Error handling
  • Type safety
  • Documentation accuracy
  • Test coverage
  • Code clarity

Automated review by Codex AI

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

  • Reviewed PR #561 (ding113/claude-code-hub), classified it as XL, and applied label size/XL.
  • Left 3 inline review comments (i18n/accessibility + UI/server error-message i18n compliance).
  • Submitted the required Code Review Summary via gh pr review --comment.

Change firstRequestAt and lastRequestAt from string to Date type
to match aggregateSessionStats return type.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@greptile-apps
Copy link

greptile-apps bot commented Jan 7, 2026

Too many files changed for review.

performance

- Remove all revalidatePath blocking calls from CRUD operations
- Add getProviderStatisticsAsync() for independent statistics loading
- Frontend: separate useQuery for statistics with 30s staleTime, 60s
  refetchInterval
- Add Skeleton loading states for statistics columns
- Add ProviderStatistics and ProviderStatisticsMap types
- Fix Chinese console.error messages to English for consistency
- Add 9 unit tests for async optimization

Expected performance improvement:
- Create provider: 30s -> <500ms
- Update provider: 10-20s -> <500ms
- Delete provider: 5-10s -> <200ms

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ding113 ding113 merged commit c176544 into main Jan 7, 2026
10 of 14 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core area:i18n area:UI enhancement New feature or request size/XL Extra Large PR (> 1000 lines)

Projects

Status: Done

5 participants