Skip to content

feat(anthropic): add adaptive thinking override support#758

Merged
ding113 merged 3 commits intodevfrom
feat/anthropic-adaptive-thinking
Feb 10, 2026
Merged

feat(anthropic): add adaptive thinking override support#758
ding113 merged 3 commits intodevfrom
feat/anthropic-adaptive-thinking

Conversation

@ding113
Copy link
Owner

@ding113 ding113 commented Feb 10, 2026

Summary

Add Anthropic adaptive thinking (thinking: { type: "adaptive" } + output_config: { effort }) as a new provider-level override option, alongside the existing custom budget mode. Admins can configure effort level (low/medium/high/max) and target specific models via prefix matching.

Problem

Anthropic's API supports an "adaptive" thinking mode where the model dynamically decides how much reasoning to apply, controlled by an effort parameter in output_config rather than a fixed budget_tokens. The existing provider override UI only supported "inherit" (passthrough) or a custom numeric budget, with no way to configure adaptive thinking at the provider level.

Solution

Extend the thinking budget preference system with a third mode ("adaptive") that:

  • Sets thinking.type to "adaptive" and injects output_config.effort on matching requests
  • Supports model-level targeting: apply to all models or only specific models with prefix matching (e.g., claude-opus-4-6 matches claude-opus-4-6-20250514)
  • Stores configuration in a new JSONB column (anthropic_adaptive_thinking) on the providers table
  • Skips budget rectification for adaptive mode (the rectifier only applies to fixed-budget thinking)
  • Tracks output_config.effort changes in the audit trail alongside existing max_tokens and thinking.budget_tokens tracking

Changes

Area Files Description
DB schema.ts, 0066_hot_mauler.sql New nullable JSONB column anthropic_adaptive_thinking
Types provider.ts AnthropicAdaptiveThinkingConfig, effort/model-match types, field added to Provider, ProviderDisplay, CreateProviderData, UpdateProviderData
Validation schemas.ts "adaptive" literal in budget pref union, new ANTHROPIC_ADAPTIVE_THINKING_CONFIG schema with superRefine cross-validation
Repository provider.ts, transformers.ts Select/insert/update/transform for new column
Actions providers.ts ProviderDisplay mapping
Override provider-overrides.ts Adaptive branch with model matching + audit trail for output_config.effort
Rectifier thinking-budget-rectifier.ts Early return (skip) when thinking.type === "adaptive"
Form UI 4 frontend files Effort selector, model match mode, tag input for target models
i18n 5 locale files (en, zh-CN, zh-TW, ja, ru) Labels, help text, option strings
Tests 2 test files 10 override tests + 5 rectifier tests

Migration

  • DB migration 0066: Adds anthropic_adaptive_thinking JSONB DEFAULT null to providers table. Non-destructive, no data transformation needed. Will auto-apply if AUTO_MIGRATE=true.

Breaking Changes

None. The new JSONB column defaults to null, and the type union change ("adaptive" added to AnthropicThinkingBudgetPreference) is additive since "adaptive" was already a valid string.

Testing

Automated Tests

  • 10 new tests in anthropic-provider-overrides.test.ts covering: all-models mode, specific-models mode, non-matching passthrough, output_config preservation, effort levels, budget_tokens removal, null config defense, combined max_tokens+adaptive, prefix matching, audit trail
  • 5 new tests in thinking-budget-rectifier.test.ts covering: trigger detection, standard rectification, adaptive skip

Manual Testing

  1. Create/edit a Claude provider, select "Adaptive Thinking" in the thinking budget dropdown
  2. Configure effort level and model targeting (all vs specific models)
  3. Save and verify the JSONB is persisted correctly in the DB
  4. Send a proxy request and verify thinking.type is set to "adaptive" and output_config.effort is injected

Checklist

  • Code follows project conventions
  • Self-review completed
  • Tests pass locally (bun run test - 56/56)
  • Lint clean (bun run lint:fix)
  • Type check clean (bun run typecheck)
  • Build succeeds (bun run build)
  • i18n: all 5 locales updated

Description enhanced by Claude AI

Greptile Overview

Greptile Summary

This PR adds an Anthropic provider-level “adaptive thinking” override alongside existing fixed thinking budgets. It persists a new providers.anthropic_adaptive_thinking JSONB config, extends validation/types/UI to edit it, applies the override at proxy-time by injecting thinking: { type: "adaptive" } and output_config.effort, and updates the thinking budget rectifier to skip adaptive requests. Unit tests cover adaptive override behavior and rectifier skip logic.

Key integration points are: settings UI → server actions/repository persistence → proxy request override/audit → rectifier behavior.

Confidence Score: 3/5

  • Not safe to merge until the provider repository select omissions are fixed.
  • Adaptive thinking config is persisted on create/update, but the repository select lists omit the new column, so saved config won’t load on fresh reads (breaking UI display and override application). There’s also an audit correctness issue where adaptive mode can mark hit=true even when no override is applied.
  • src/repository/provider.ts and src/lib/anthropic/provider-overrides.ts

Important Files Changed

Filename Overview
drizzle/0066_hot_mauler.sql Adds providers.anthropic_adaptive_thinking JSONB column with SQL NULL default.
src/lib/anthropic/provider-overrides.ts Adds adaptive thinking override branch with model prefix matching and audit tracking; audit 'hit' can be true even when no override applied.
src/actions/providers.ts Maps Provider→ProviderDisplay and includes anthropicAdaptiveThinking field in server action outputs.
src/repository/provider.ts Persists anthropicAdaptiveThinking on create/update and returns it from insert/update; but list/byId selects omit anthropicAdaptiveThinking so it won't load from DB.
src/app/[locale]/settings/providers/_components/forms/provider-form/sections/routing-section.tsx Adds adaptive thinking UI (effort, model match mode, models) gated behind anthropicThinkingBudgetPreference === 'adaptive'.
src/app/[locale]/settings/providers/_components/forms/provider-form/provider-form-context.tsx Initializes and updates form state for anthropicAdaptiveThinking when selecting adaptive thinking budget.
src/app/[locale]/settings/providers/_components/forms/provider-form/provider-form-types.ts Extends provider form state/action types to include anthropic adaptive thinking config types.
src/app/[locale]/settings/providers/_components/forms/provider-form/index.tsx Includes anthropic_adaptive_thinking in submitted form data when thinking budget preference is 'adaptive'.
src/app/v1/_lib/proxy/thinking-budget-rectifier.ts Skips rectification when thinking.type is 'adaptive'; otherwise continues existing budget fix-up behavior.
src/lib/validation/schemas.ts Adds 'adaptive' to Anthropic thinking budget preference union and defines ANTHROPIC_ADAPTIVE_THINKING_CONFIG with cross-field refinement.
src/types/provider.ts Adds Anthropic adaptive thinking types and wires anthropicAdaptiveThinking through Provider/ProviderDisplay/Create/Update types.
src/drizzle/schema.ts Adds providers.anthropicAdaptiveThinking jsonb column (nullable) in Drizzle schema.
src/repository/_shared/transformers.ts Extends toProvider transformer to include anthropicAdaptiveThinking field from DB rows.
drizzle/meta/0066_snapshot.json Drizzle snapshot for migration 0066 reflecting new anthropic_adaptive_thinking jsonb column.
drizzle/meta/_journal.json Updates Drizzle migration journal to include migration 0066 entry.
tests/unit/proxy/anthropic-provider-overrides.test.ts Adds unit tests covering adaptive thinking override behavior, prefix matching, output_config preservation, and audit tracking.
tests/unit/proxy/thinking-budget-rectifier.test.ts Adds rectifier tests including skip behavior for thinking.type === 'adaptive'.
messages/en/settings/providers/form/sections.json Adds i18n strings for adaptive thinking UI (effort, model match mode, target models) and thinking budget option label.
messages/ja/settings/providers/form/sections.json Adds Japanese i18n strings for adaptive thinking form labels/options.
messages/ru/settings/providers/form/sections.json Adds Russian i18n strings for adaptive thinking form labels/options.
messages/zh-CN/settings/providers/form/sections.json Adds zh-CN i18n strings for Anthropic adaptive thinking effort/model matching/target models fields.
messages/zh-TW/settings/providers/form/sections.json Adds zh-TW i18n strings for Anthropic adaptive thinking effort/model matching/target models fields.

Sequence Diagram

sequenceDiagram
  participant Admin
  participant Action
  participant Repo
  participant DB
  participant Proxy
  participant Ov
  participant Rectifier
  participant Up

  Admin->>Action: Submit provider form
  Action->>Repo: updateProvider/createProvider
  Repo->>DB: persist config
  DB-->>Repo: row
  Repo-->>Action: provider
  Action-->>Admin: provider display

  Proxy->>Ov: apply overrides
  Ov-->>Proxy: overridden request
  Proxy->>Rectifier: rectify budget
  Rectifier-->>Proxy: result
  Proxy->>Up: send request
  Up-->>Proxy: response
Loading

Add adaptive thinking as a new option in the Anthropic thinking override
settings on the provider form, supporting the new API format:
- thinking: { type: "adaptive" } + output_config: { effort: "low"|"medium"|"high"|"max" }
- Model-level targeting: apply to all models or specific models with prefix matching
- Full audit trail tracking output_config.effort changes
- Rectifier safety: skip budget rectification for adaptive mode
- DB: new JSONB column anthropic_adaptive_thinking on providers table
- i18n: all 5 locales (en, zh-CN, zh-TW, ja, ru)
- Tests: 10 override tests + 5 rectifier tests (56/56 passing)
@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

新增 Anthropic 自适应思考配置(anthropic_adaptive_thinking),涵盖数据库列、类型与验证、后端持久化、覆盖逻辑、前端表单/状态、多语言文案及单元测试。

Changes

Cohort / File(s) Summary
数据库迁移与快照
drizzle/0066_hot_mauler.sql, drizzle/meta/0066_snapshot.json, drizzle/meta/_journal.json, src/drizzle/schema.ts
providers 表添加 anthropic_adaptive_thinking(jsonb, 默认 null);新增迁移、快照与 journal 条目以记录模式变更。
类型定义
src/types/provider.ts
新增 AnthropicAdaptiveThinkingEffort / AnthropicAdaptiveThinkingModelMatchMode / AnthropicAdaptiveThinkingConfig,并在 Provider/ProviderDisplay/Create/Update 数据结构中加入 anthropicAdaptiveThinking 字段。
后端持久化与转换
src/repository/provider.ts, src/repository/_shared/transformers.ts, src/actions/providers.ts
创建/更新/读取流程接受并持久化 anthropic_adaptive_thinking,并在返回的 Provider/ProviderDisplay 中包含该字段。
前端表单与状态管理
src/app/[locale]/settings/providers/_components/forms/provider-form/index.tsx, .../provider-form-context.tsx, .../provider-form-types.ts, .../sections/routing-section.tsx
表单 payload 与路由状态新增 anthropic_adaptive_thinking;选择 thinkingBudget 为 adaptive 时初始化默认值;新增 reducer action 与表单控件(effort、modelMatchMode、models)及条件渲染。
验证逻辑
src/lib/validation/schemas.ts
新增 ANTHROPIC_ADAPTIVE_THINKING_CONFIG schema,扩展 ANTHROPIC_THINKING_BUDGET_PREFERENCE 包含 adaptive,并在 Create/Update Provider Schema 中对 adaptive 模式强制校验对应配置。
Anthropic 覆盖与整流逻辑
src/lib/anthropic/provider-overrides.ts, src/app/v1/_lib/proxy/thinking-budget-rectifier.ts
在应用提供者覆盖时支持 adaptive thinking:将 thinking.type 设为 adaptive、按匹配规则合并 effortoutput_config 并短路 rectifier 以避免修改预算;审计路径扩展以记录 output_config.effort 变化。
国际化文案
messages/en/settings/providers/form/sections.json, messages/ja/.../sections.json, messages/ru/.../sections.json, messages/zh-CN/.../sections.json, messages/zh-TW/.../sections.json
新增多语言表单块与选项(effort、modelMatchMode、models),并在 thinkingBudget 选项中加入 adaptive
测试
tests/unit/proxy/anthropic-provider-overrides.test.ts, tests/unit/proxy/thinking-budget-rectifier.test.ts
新增针对自适应思考模式的单元测试,覆盖模型匹配、effort 应用、output_config 变更、审计记录及 rectifier 的 adaptive 分支行为。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了拉取请求的主要变更:为Anthropic添加自适应思考覆盖支持。标题简洁、清晰且具体。
Description check ✅ Passed 描述与变更集相关,详细说明了问题、解决方案和影响范围,与代码修改一致。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/anthropic-adaptive-thinking

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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 pull request significantly enhances Anthropic provider configuration by introducing 'Adaptive Thinking' capabilities. This feature allows providers to dynamically adjust the reasoning effort for Anthropic models, either globally or for specific models, based on predefined effort levels. It provides a more flexible and intelligent way to manage model behavior, moving beyond static budget token settings. The changes span database schema, API logic, validation, and the user interface, ensuring a robust and user-friendly implementation. This enables users to optimize model performance and resource usage more effectively.

Highlights

  • Adaptive Thinking Support: Introduced a new 'Adaptive Thinking' option for Anthropic providers, allowing dynamic adjustment of reasoning effort based on model usage.
  • Model-Level Targeting: Enabled configuration of adaptive thinking to apply to all models or specific models using prefix matching, providing granular control.
  • Comprehensive Audit Trail: Implemented full audit trail tracking for changes made to output_config.effort when adaptive thinking is applied.
  • Rectifier Safety: Modified the thinking budget rectifier to skip budget rectification when adaptive thinking mode is active, preventing conflicts.
  • Database and UI Integration: Added a new JSONB column anthropic_adaptive_thinking to the providers table and integrated corresponding UI controls and internationalization for all supported locales.
Changelog
  • drizzle/0066_hot_mauler.sql
    • Added a new anthropic_adaptive_thinking JSONB column to the providers table with a default of 'null'.
  • drizzle/meta/0066_snapshot.json
    • Updated the Drizzle ORM snapshot to reflect the new anthropic_adaptive_thinking column in the providers table.
  • drizzle/meta/_journal.json
    • Recorded the new migration 0066_hot_mauler in the Drizzle ORM journal.
  • messages/en/settings/providers/form/sections.json
    • Added new internationalization keys for 'Adaptive Thinking' option, effort levels (low, medium, high, max), model matching modes (all, specific), and target models in the Anthropic overrides section.
  • messages/ja/settings/providers/form/sections.json
    • Added Japanese internationalization keys for 'Adaptive Thinking' option, effort levels, model matching modes, and target models.
  • messages/ru/settings/providers/form/sections.json
    • Added Russian internationalization keys for 'Adaptive Thinking' option, effort levels, model matching modes, and target models.
  • messages/zh-CN/settings/providers/form/sections.json
    • Added Simplified Chinese internationalization keys for 'Adaptive Thinking' option, effort levels, model matching modes, and target models.
  • messages/zh-TW/settings/providers/form/sections.json
    • Added Traditional Chinese internationalization keys for 'Adaptive Thinking' option, effort levels, model matching modes, and target models.
  • src/actions/providers.ts
    • Included anthropicAdaptiveThinking in the ProviderDisplay mapping for retrieval.
  • src/app/[locale]/settings/providers/_components/forms/provider-form/index.tsx
    • Modified the form submission logic to conditionally save anthropic_adaptive_thinking data when the adaptive thinking preference is selected.
  • src/app/[locale]/settings/providers/_components/forms/provider-form/provider-form-context.tsx
    • Initialized anthropicAdaptiveThinking in the form's initial state.
    • Added new reducer actions (SET_ADAPTIVE_THINKING_EFFORT, SET_ADAPTIVE_THINKING_MODEL_MATCH_MODE, SET_ADAPTIVE_THINKING_MODELS) to manage adaptive thinking configuration.
    • Updated the SET_ANTHROPIC_THINKING_BUDGET action to handle the 'adaptive' payload, initializing default adaptive thinking settings if not already present.
  • src/app/[locale]/settings/providers/_components/forms/provider-form/provider-form-types.ts
    • Imported and defined new types for AnthropicAdaptiveThinkingConfig, AnthropicAdaptiveThinkingEffort, and AnthropicAdaptiveThinkingModelMatchMode.
  • src/app/[locale]/settings/providers/_components/forms/provider-form/sections/routing-section.tsx
    • Added UI components for configuring adaptive thinking, including effort level selection, model matching mode, and target model input, displayed when 'Adaptive Thinking' is chosen.
  • src/app/v1/_lib/proxy/thinking-budget-rectifier.ts
    • Modified rectifyThinkingBudget to bypass rectification if the thinking.type in the message is set to 'adaptive'.
  • src/drizzle/schema.ts
    • Added anthropicAdaptiveThinking as a JSONB column to the providers table, storing structured configuration for adaptive thinking.
  • src/lib/anthropic/provider-overrides.ts
    • Implemented logic to apply adaptive thinking overrides, setting thinking: { type: 'adaptive' } and output_config: { effort } based on provider configuration.
    • Added model matching logic to apply adaptive thinking only to specified models or all models.
    • Enhanced the audit trail to include changes to output_config.effort when adaptive thinking is used.
  • src/lib/validation/schemas.ts
    • Extended ANTHROPIC_THINKING_BUDGET_PREFERENCE schema to include 'adaptive' as a valid option.
    • Defined a new ANTHROPIC_ADAPTIVE_THINKING_CONFIG schema for validating the adaptive thinking configuration object.
    • Added superRefine logic to ensure anthropic_adaptive_thinking is present when the budget preference is 'adaptive' for both creation and update schemas.
  • src/repository/_shared/transformers.ts
    • Included anthropicAdaptiveThinking in the toProvider data transformation function.
  • src/repository/provider.ts
    • Updated createProvider and updateProvider functions to handle the new anthropicAdaptiveThinking field.
  • src/types/provider.ts
    • Defined AnthropicAdaptiveThinkingEffort, AnthropicAdaptiveThinkingModelMatchMode, and AnthropicAdaptiveThinkingConfig types.
    • Updated AnthropicThinkingBudgetPreference to include 'adaptive' as a possible value.
    • Added anthropicAdaptiveThinking to the Provider, ProviderDisplay, CreateProviderData, and UpdateProviderData interfaces.
  • tests/unit/proxy/anthropic-provider-overrides.test.ts
    • Added new unit tests to verify the correct application of adaptive thinking overrides, including model matching, preservation of existing output_config properties, and audit trail tracking.
  • tests/unit/proxy/thinking-budget-rectifier.test.ts
    • Added a new unit test to confirm that the thinking budget rectifier correctly skips rectification when thinking.type is 'adaptive'.
Activity
  • All type checks passed successfully.
  • All 56 unit tests passed, including 15 new tests for adaptive thinking and rectifier logic.
  • Linting checks passed without issues.
  • The project built successfully.
  • Manual testing is planned to verify the end-to-end functionality of creating an Anthropic provider with adaptive thinking, configuring effort and models, saving to the database, and observing proxy output.
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 enhancement New feature or request area:Anthropic area:provider area:i18n area:UI size/XL Extra Large PR (> 1000 lines) labels Feb 10, 2026
@github-actions
Copy link
Contributor

🧪 测试结果

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

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

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 introduces support for Anthropic's adaptive thinking override, allowing providers to configure dynamic reasoning effort based on model matching. The changes include database schema updates, new types, UI controls for configuring adaptive thinking, and modifications to the Anthropic provider override logic to apply these settings. Additionally, the thinking budget rectifier has been updated to correctly skip rectification when adaptive thinking is enabled. Comprehensive unit tests have been added to ensure the correctness of the new functionality across various scenarios.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/repository/provider.ts (1)

216-218: ⚠️ Potential issue | 🔴 Critical

findProviderListfindAllProvidersFreshfindProviderById 三个查询函数的 select 对象中缺少 anthropicAdaptiveThinking 列。

写入路径(createProviderupdateProvider)正确地包含了 anthropicAdaptiveThinking,但所有读取路径都遗漏了该列。这导致:

  1. 运行时 provider override 逻辑无法获取自适应思考配置,功能完全失效
  2. 编辑已有 provider 时表单无法回显自适应思考配置
  3. Provider 列表/缓存中该字段始终为 null

需要在各函数的 select 对象中补充该列:

修复位置
  • findProviderList (~Line 218):在 anthropicThinkingBudgetPreferencegeminiGoogleSearchPreference 之间添加
  • findAllProvidersFresh (~Line 296):同上
  • findProviderById (~Line 378):同上
🤖 Fix all issues with AI agents
In `@src/actions/providers.ts`:
- Line 284: The addProvider and editProvider functions are missing the
anthropic_adaptive_thinking field in their data parameter type signatures;
update the data types for addProvider and editProvider to include an optional
anthropic_adaptive_thinking?: AnthropicAdaptiveThinkingConfig | null so
TypeScript reflects the CreateProviderSchema/UpdateProviderSchema and matches
the ProviderDisplay mapping; ensure the new property name and type match the Zod
schema (CreateProviderSchema/UpdateProviderSchema) and existing
AnthropicAdaptiveThinkingConfig type to restore IDE autocomplete and
compile-time checks.

In `@src/lib/validation/schemas.ts`:
- Around line 59-66: The ANTHROPIC_ADAPTIVE_THINKING_CONFIG schema must enforce
that when modelMatchMode === "specific" the models array is non-empty; update
the schema (using zod's superRefine or a conditional refinement on the
ANTHROPIC_ADAPTIVE_THINKING_CONFIG object) to check modelMatchMode and then
require models?.length > 0, adding a clear validation error message if models is
empty or undefined; make sure this logic respects the schema's
nullable()/optional() wrapping so null/undefined remains valid but specific mode
always requires at least one model.
🧹 Nitpick comments (7)
src/app/v1/_lib/proxy/thinking-budget-rectifier.ts (1)

64-81: 自适应模式的跳过逻辑正确。

thinking.type === "adaptive" 时,整流器正确地返回 applied: falsebefore/after 状态一致,避免对自适应模式的请求进行不必要的修改。

有一个小的代码重复:budget_tokens 的提取逻辑(Lines 71-72, 77-78)与下方 Lines 82-83 重复。可以考虑提取为局部变量后再做分支判断。

可选:提取公共变量减少重复
   const currentThinkingType = thinking && typeof thinking.type === "string" ? thinking.type : null;
+  const currentThinkingBudgetTokens =
+    thinking && typeof thinking.budget_tokens === "number" ? thinking.budget_tokens : null;
 
   if (currentThinkingType === "adaptive") {
     return {
       applied: false,
       before: {
         maxTokens: currentMaxTokens,
         thinkingType: currentThinkingType,
-        thinkingBudgetTokens:
-          thinking && typeof thinking.budget_tokens === "number" ? thinking.budget_tokens : null,
+        thinkingBudgetTokens: currentThinkingBudgetTokens,
       },
       after: {
         maxTokens: currentMaxTokens,
         thinkingType: currentThinkingType,
-        thinkingBudgetTokens:
-          thinking && typeof thinking.budget_tokens === "number" ? thinking.budget_tokens : null,
+        thinkingBudgetTokens: currentThinkingBudgetTokens,
       },
     };
   }
-  const currentThinkingBudgetTokens =
-    thinking && typeof thinking.budget_tokens === "number" ? thinking.budget_tokens : null;
tests/unit/proxy/thinking-budget-rectifier.test.ts (1)

1-53: 测试覆盖整体合理,建议补充边界场景。

adaptive 路径的核心行为(applied: falsebefore/after 一致性)已覆盖。但 rectifyThinkingBudget 还有几个分支未被测试:

  • 入参不含 thinking 对象时(会创建新的 thinking 并强制 enabled
  • max_tokens < MIN_MAX_TOKENS_FOR_BUDGET 时的 max_tokens 自动拉升
  • adaptive 模式下 thinking 对象包含 budget_tokens 的情况(验证返回值中 thinkingBudgetTokens 仍为该数值)

这些分支对于确保 rectifier 在生产中正确工作比较重要。

src/lib/anthropic/provider-overrides.ts (1)

63-81: adaptive 分支在 config 为 null 时静默跳过所有 thinking 覆盖。

anthropicThinkingBudgetPreference === "adaptive"anthropicAdaptiveThinkingnull(管理员选择了「自适应思考」但未完成配置)时,Line 80 的 return output 会跳过后续的 thinkingBudget 数值分支,导致 thinking 完全不被覆盖。

这个行为可能是有意为之(passthrough),但如果管理员误操作,请求将静默透传而无任何提示。建议考虑是否需要在此处添加日志以便排查。

另外,当 modelMatchMode"specific"models 数组为空时,some() 永远返回 false,即所有模型都不会命中——行为正确但管理员可能不容易意识到。

src/app/[locale]/settings/providers/_components/forms/provider-form/sections/routing-section.tsx (1)

707-833: 自适应思考 UI 区块实现良好,与现有 Codex/Anthropic override 的 UI 模式保持一致。

guard condition (budgetPreference === "adaptive" && anthropicAdaptiveThinking !== null) 确保了安全渲染,effort/modelMatchMode/models 三个控件都正确绑定了对应 action。建议关注一个边缘场景:当 modelMatchMode"specific"models 数组为空时,用户可能无意中保存了一个不匹配任何模型的配置(相当于自适应思考不生效)。可以考虑在 UI 或提交时加一个提示。

src/app/[locale]/settings/providers/_components/forms/provider-form/provider-form-context.tsx (1)

189-191: 默认模型名 "claude-opus-4-6" 是硬编码值。

作为 UI 初始默认值可以接受,但随着 Anthropic 发布新模型,这个默认值可能变得过时。考虑将其提取为常量或从配置中读取,方便后续维护。

tests/unit/proxy/anthropic-provider-overrides.test.ts (1)

886-907: 测试标题与实际机制轻微不符(可选 nit)。

标题 "should remove budget_tokens from existing thinking when applying adaptive" 暗示选择性移除 budget_tokens,但实现实际上是用 { type: "adaptive" } 完全替换 thinking 对象。测试断言本身是正确的,只是标题可以更精确,例如 "should replace thinking object with adaptive type"。

src/lib/validation/schemas.ts (1)

595-604: superRefine 中 adaptive 校验逻辑在 Create 和 Update schema 中完全重复

Lines 595-604 和 Lines 805-814 的校验逻辑完全相同。可以考虑提取为一个共享的 refinement 函数,减少维护成本。

♻️ 建议的重构方案

在文件顶部定义共享函数:

function refineAnthropicThinkingBudget(
  data: {
    anthropic_max_tokens_preference?: string;
    anthropic_thinking_budget_preference?: string;
    anthropic_adaptive_thinking?: { effort: string; modelMatchMode: string; models: string[] } | null;
  },
  ctx: z.RefinementCtx
) {
  const maxTokens = data.anthropic_max_tokens_preference;
  const budget = data.anthropic_thinking_budget_preference;
  if (budget === "adaptive") {
    if (!data.anthropic_adaptive_thinking) {
      ctx.addIssue({
        code: z.ZodIssueCode.custom,
        message: "adaptive thinking config is required when mode is adaptive",
        path: ["anthropic_adaptive_thinking"],
      });
    }
    return;
  }
  if (maxTokens && maxTokens !== "inherit" && budget && budget !== "inherit") {
    const maxTokensNum = Number.parseInt(maxTokens, 10);
    const budgetNum = Number.parseInt(budget, 10);
    if (budgetNum >= maxTokensNum) {
      ctx.addIssue({
        code: z.ZodIssueCode.custom,
        message: "thinking.budget_tokens must be less than max_tokens",
        path: ["anthropic_thinking_budget_preference"],
      });
    }
  }
}

然后两处均使用 .superRefine(refineAnthropicThinkingBudget)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

10 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +63 to +80
if (provider.anthropicThinkingBudgetPreference === "adaptive") {
const config = provider.anthropicAdaptiveThinking;
if (config) {
const modelId = typeof request.model === "string" ? request.model : null;
const isMatch =
config.modelMatchMode === "all" ||
(modelId !== null &&
config.models.some((m) => modelId === m || modelId.startsWith(`${m}-`)));
if (isMatch) {
ensureCloned();
output.thinking = { type: "adaptive" };
const existingOutputConfig = isPlainObject(output.output_config)
? output.output_config
: {};
output.output_config = { ...existingOutputConfig, effort: config.effort };
}
}
return output;
Copy link

Choose a reason for hiding this comment

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

Adaptive thinking leaves stale budget

When adaptive thinking matches, this branch sets output.thinking = { type: "adaptive" }, which drops any existing thinking fields (including budget_tokens). That’s OK, but it also returns early (line 80) without cleaning up an existing thinking.budget_tokens if some other code merges thinking objects rather than replacing them. To make the behavior robust and consistent with the test intent (“remove budget_tokens when applying adaptive”), explicitly delete budget_tokens from any existing thinking object before setting adaptive (or set output.thinking by spreading and omitting budget). Otherwise callers that pass a thinking object through another transformer could still end up sending budget_tokens alongside adaptive type.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/anthropic/provider-overrides.ts
Line: 63:80

Comment:
**Adaptive thinking leaves stale budget**

When adaptive thinking matches, this branch sets `output.thinking = { type: "adaptive" }`, which drops any existing `thinking` fields (including `budget_tokens`). That’s OK, but it *also* returns early (line 80) without cleaning up an existing `thinking.budget_tokens` if some other code merges thinking objects rather than replacing them. To make the behavior robust and consistent with the test intent (“remove budget_tokens when applying adaptive”), explicitly delete `budget_tokens` from any existing thinking object before setting adaptive (or set `output.thinking` by spreading and omitting budget). Otherwise callers that pass a `thinking` object through another transformer could still end up sending `budget_tokens` alongside adaptive type.

How can I resolve this? If you propose a fix, please make it concise.

@@ -0,0 +1 @@
ALTER TABLE "providers" ADD COLUMN "anthropic_adaptive_thinking" jsonb DEFAULT 'null'::jsonb; No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Migration default is JSON null

This migration sets DEFAULT 'null'::jsonb rather than SQL DEFAULT NULL. That creates a JSONB value of null (distinct from SQL NULL) in existing rows, which can behave differently in queries/indexing and is easy to mis-handle in code expecting NULL. If the intent is “no config”, use DEFAULT NULL (or omit default) to store SQL NULL consistently with schema.ts’s .default(null) expectation.

Prompt To Fix With AI
This is a comment left during a code review.
Path: drizzle/0066_hot_mauler.sql
Line: 1:1

Comment:
**Migration default is JSON null**

This migration sets `DEFAULT 'null'::jsonb` rather than SQL `DEFAULT NULL`. That creates a JSONB value of `null` (distinct from SQL NULL) in existing rows, which can behave differently in queries/indexing and is easy to mis-handle in code expecting `NULL`. If the intent is “no config”, use `DEFAULT NULL` (or omit default) to store SQL NULL consistently with `schema.ts`’s `.default(null)` expectation.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 56 to 70
),
]);

const ANTHROPIC_ADAPTIVE_THINKING_CONFIG = z
.object({
effort: z.enum(["low", "medium", "high", "max"]),
modelMatchMode: z.enum(["specific", "all"]),
models: z.array(z.string().min(1).max(100)).max(50),
})
.nullable()
.optional();

// Gemini (generateContent API) Google Search preference
// - 'inherit': follow client request (default)
// - 'enabled': force inject googleSearch tool
Copy link

Choose a reason for hiding this comment

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

Adaptive models not required

ANTHROPIC_ADAPTIVE_THINKING_CONFIG.models allows an empty array even when modelMatchMode is "specific" (only .max(50) is enforced). With the current override logic, specific + empty models means adaptive mode will silently never apply. If specific is selected, models should be .min(1) (or enforced via superRefine) to prevent saving a non-functional config.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/validation/schemas.ts
Line: 56:70

Comment:
**Adaptive models not required**

`ANTHROPIC_ADAPTIVE_THINKING_CONFIG.models` allows an empty array even when `modelMatchMode` is `"specific"` (only `.max(50)` is enforced). With the current override logic, `specific` + empty `models` means adaptive mode will silently never apply. If `specific` is selected, `models` should be `.min(1)` (or enforced via `superRefine`) to prevent saving a non-functional config.

How can I resolve this? If you propose a fix, please make it concise.

1. Add anthropic_adaptive_thinking, anthropic_max_tokens_preference, and
   anthropic_thinking_budget_preference to addProvider/editProvider type
   signatures for IDE autocomplete and compile-time safety.

2. Add .refine() validation ensuring models array is non-empty when
   modelMatchMode is "specific" in adaptive thinking config schema.
Change DEFAULT 'null'::jsonb to DEFAULT NULL in the migration for
anthropic_adaptive_thinking column. JSONB null and SQL NULL have
different semantics in queries and indexing.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/validation/schemas.ts (1)

805-830: ⚠️ Potential issue | 🟡 Minor

部分更新场景下可能产生数据不一致。

UpdateProviderSchema 中,如果用户仅发送 anthropic_adaptive_thinking: null(清除配置)而不同时发送 anthropic_thinking_budget_preference,校验会通过(因为 budgetundefined,不会触发 adaptive 分支检查)。这可能导致数据库中 budget = "adaptive"anthropic_adaptive_thinking = null 的不一致状态。

建议在应用层(如 action/service 层)补充一致性保障,或在 superRefine 中增加反向检查:当 anthropic_adaptive_thinking 被显式设为 null 时,如果需要也校验 budget 是否仍为 "adaptive"

@ding113 ding113 merged commit 129f69d into dev Feb 10, 2026
10 of 11 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Feb 10, 2026
@github-actions
Copy link
Contributor

🧪 测试结果

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

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

.object({
effort: z.enum(["low", "medium", "high", "max"]),
modelMatchMode: z.enum(["specific", "all"]),
models: z.array(z.string().min(1).max(100)).max(50),
Copy link
Contributor

Choose a reason for hiding this comment

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

[HIGH] [TYPE-MISSING-VALIDATION] modelMatchMode: "specific" allows empty models (adaptive override becomes a silent no-op)

Why this is a problem: ANTHROPIC_ADAPTIVE_THINKING_CONFIG currently permits models: [] (src/lib/validation/schemas.ts:63), but the matcher later does config.models.some(...) (src/lib/anthropic/provider-overrides.ts:70). With an empty list and "specific" mode, no model can match, so adaptive thinking is never applied even though the provider is configured for it.

Suggested fix:

const ANTHROPIC_ADAPTIVE_THINKING_CONFIG = z
  .discriminatedUnion("modelMatchMode", [
    z.object({
      effort: z.enum(["low", "medium", "high", "max"]),
      modelMatchMode: z.literal("all"),
      models: z.array(z.string().min(1).max(100)).max(50).default([]),
    }),
    z.object({
      effort: z.enum(["low", "medium", "high", "max"]),
      modelMatchMode: z.literal("specific"),
      models: z.array(z.string().min(1).max(100)).min(1).max(50),
    }),
  ])
  .nullable()
  .optional();

if (!data.anthropic_adaptive_thinking) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "adaptive thinking config is required when mode is adaptive",
Copy link
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] [TEST-MISSING-CRITICAL] New adaptive-thinking validation branches are untested

Why this is a problem: CreateProviderSchema and UpdateProviderSchema now have new superRefine branches for anthropic_thinking_budget_preference === "adaptive" (src/lib/validation/schemas.ts:595 and src/lib/validation/schemas.ts:805). Per repo standards, new feature logic should be covered (see CLAUDE.md:13: "All new features must have unit test coverage of at least 80%"), otherwise regressions can silently re-allow invalid provider configs.

Suggested fix (add to src/lib/validation/schemas.test.ts):

test("CreateProviderSchema: adaptive requires config", () => {
  const base = { name: "p", url: "https://api.example.com", key: "sk-test" };

  expect(
    CreateProviderSchema.safeParse({
      ...base,
      anthropic_thinking_budget_preference: "adaptive",
    }).success
  ).toBe(false);

  expect(
    CreateProviderSchema.safeParse({
      ...base,
      anthropic_thinking_budget_preference: "adaptive",
      anthropic_adaptive_thinking: { effort: "high", modelMatchMode: "all", models: [] },
    }).success
  ).toBe(true);
});

test("UpdateProviderSchema: setting adaptive requires config", () => {
  expect(
    UpdateProviderSchema.safeParse({
      anthropic_thinking_budget_preference: "adaptive",
    }).success
  ).toBe(false);

  expect(
    UpdateProviderSchema.safeParse({
      anthropic_thinking_budget_preference: "adaptive",
      anthropic_adaptive_thinking: { effort: "high", modelMatchMode: "all", models: [] },
    }).success
  ).toBe(true);
});

const existingOutputConfig = isPlainObject(output.output_config)
? output.output_config
: {};
output.output_config = { ...existingOutputConfig, effort: config.effort };
Copy link
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] [COMMENT-INACCURATE] applyAnthropicProviderOverrides doc comment no longer matches behavior

Why this is a problem: The JSDoc says overrides only affect max_tokens and thinking.* (src/lib/anthropic/provider-overrides.ts:38), but adaptive mode now also writes output_config.effort via output.output_config = { ...existingOutputConfig, effort: config.effort } (src/lib/anthropic/provider-overrides.ts:77). This mismatch makes it easy to miss downstream impacts when adding or debugging overrides.

Suggested fix:

 * - Overrides only affect:
 *   - max_tokens
 *   - thinking.type / thinking.budget_tokens
 *   - output_config.effort (adaptive thinking only)

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

No significant issues identified in this PR. The implementation is well-structured, follows existing codebase patterns, and includes comprehensive test coverage for the new adaptive thinking override feature.

PR Size: XL

  • Lines changed: 3835 (3781 additions + 54 deletions)
  • Files changed: 22
  • Note: ~2983 lines are the auto-generated Drizzle snapshot (drizzle/meta/0066_snapshot.json). Actual code changes are ~850 lines across 19 files, which is closer to a M/L PR in practice.

Review Coverage

  • Logic and correctness - Clean. The adaptive branch in applyAnthropicProviderOverrides correctly handles all-models vs specific-models matching with prefix support, properly removes budget_tokens when switching to adaptive, and the early return prevents falling through to the numeric budget path.
  • Security (OWASP Top 10) - Clean. No user-controlled input reaches SQL or shell. JSONB column is validated through Zod before persistence.
  • Error handling - Clean. Null/undefined config is handled defensively (passthrough when anthropicAdaptiveThinking is null). The rectifier correctly skips adaptive thinking type.
  • Type safety - Clean. Types are properly threaded through the full stack (schema -> repository -> actions -> form state -> submission). The Drizzle $type uses string for JSONB fields which is a common pattern given Zod validates at the boundary.
  • Documentation accuracy - Clean. Comments match code behavior. The JSDoc on applyAnthropicProviderOverrides could be updated to mention output_config.effort, but this is minor.
  • Test coverage - Adequate. 10 new override tests cover: all-models mode, specific-models mode, non-matching passthrough, output_config preservation, effort levels, budget_tokens removal, null config defense, combined max_tokens+adaptive, prefix matching, and audit trail. 5 new rectifier tests cover trigger detection and adaptive skip.
  • Code clarity - Good. The adaptive branch is cleanly separated from the numeric budget path. Form state management correctly preserves config when toggling modes while nullifying on submission when not in adaptive mode.
  • i18n - All 5 locales (en, zh-CN, zh-TW, ja, ru) updated with matching key structures.

Automated review by Claude 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.

Code Review Summary

This is an XL PR that spans DB, validation, proxy logic, UI, i18n, and tests for Anthropic adaptive thinking overrides. The wiring is mostly consistent, but the current validation allows an invalid configuration state that results in adaptive thinking being silently skipped.

PR Size: XL

  • Lines changed: 3835
  • Files changed: 22
  • Split suggestion: Consider splitting into (1) DB/schema + repository/types, (2) proxy override/rectifier + backend logic, (3) provider form UI + i18n, (4) tests.

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 1 0 0
Comments/Docs 0 0 1 0
Tests 0 0 1 0
Simplification 0 0 0 0

Critical Issues (Must Fix)

None.

High Priority Issues (Should Fix)

  • [High] [TYPE-MISSING-VALIDATION] src/lib/validation/schemas.ts:63 allows modelMatchMode: "specific" with models: [], which makes adaptive override a silent no-op.
  • [Medium] [TEST-MISSING-CRITICAL] src/lib/validation/schemas.ts:595 / src/lib/validation/schemas.ts:805 add new adaptive validation branches without corresponding unit tests.
  • [Medium] [COMMENT-INACCURATE] src/lib/anthropic/provider-overrides.ts:32 JSDoc no longer reflects that adaptive mode writes output_config.effort.

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.

  • Identified PR #758 and applied label size/XL.
  • Left 3 inline review comments (diff-only):
    • src/lib/validation/schemas.ts:63[TYPE-MISSING-VALIDATION] allowlist enables "specific" + empty models, making adaptive thinking a silent no-op.
    • src/lib/validation/schemas.ts:599[TEST-MISSING-CRITICAL] new adaptive superRefine branches lack unit tests; suggested concrete schemas.test.ts cases.
    • src/lib/anthropic/provider-overrides.ts:77[COMMENT-INACCURATE] JSDoc no longer reflects that adaptive mode also writes output_config.effort.
  • Submitted the required summary review via gh pr review --comment (includes XL split suggestions and issue matrix).

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

22 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@@ -0,0 +1 @@
ALTER TABLE "providers" ADD COLUMN "anthropic_adaptive_thinking" jsonb DEFAULT NULL; No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Missing trailing newline
The migration file is missing a trailing newline (\ No newline at end of file). Some tooling (formatters, patch applicators, certain SQL runners) can choke on this; it’s worth adding a newline so the file is well-formed across environments.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: drizzle/0066_hot_mauler.sql
Line: 1:1

Comment:
**Missing trailing newline**
The migration file is missing a trailing newline (`\ No newline at end of file`). Some tooling (formatters, patch applicators, certain SQL runners) can choke on this; it’s worth adding a newline so the file is well-formed across environments.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +63 to +66
if (provider.anthropicThinkingBudgetPreference === "adaptive") {
const config = provider.anthropicAdaptiveThinking;
if (config) {
const modelId = typeof request.model === "string" ? request.model : null;
Copy link

Choose a reason for hiding this comment

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

Adaptive override flags hit
In applyAnthropicProviderOverridesWithAudit, hit is set to true whenever anthropicThinkingBudgetPreference === "adaptive" (even if anthropicAdaptiveThinking is null or doesn’t match the request model), which produces an audit record that looks like an override was applied when it wasn’t. This can confuse audit consumers because hit: true but all changes[].changed are false.

Also appears at src/lib/anthropic/provider-overrides.ts:124-128.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/anthropic/provider-overrides.ts
Line: 63:66

Comment:
**Adaptive override flags hit**
In `applyAnthropicProviderOverridesWithAudit`, `hit` is set to true whenever `anthropicThinkingBudgetPreference === "adaptive"` (even if `anthropicAdaptiveThinking` is null or doesn’t match the request model), which produces an audit record that looks like an override was applied when it wasn’t. This can confuse audit consumers because `hit: true` but all `changes[].changed` are false.

Also appears at `src/lib/anthropic/provider-overrides.ts:124-128`.

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps
Copy link

greptile-apps bot commented Feb 10, 2026

Additional Comments (1)

src/repository/provider.ts
Adaptive thinking never loads
createProvider/updateProvider return providers.anthropicAdaptiveThinking, but findProviderList, findAllProvidersFresh, and findProviderById do not select providers.anthropicAdaptiveThinking at all. That means once saved, the adaptive config will come back as undefined/null after a fresh fetch and the UI/override layer can’t apply it.

Also appears in the select lists at src/repository/provider.ts:171-231, src/repository/provider.ts:248-315, and src/repository/provider.ts:330-386.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/repository/provider.ts
Line: 167:220

Comment:
**Adaptive thinking never loads**
`createProvider`/`updateProvider` return `providers.anthropicAdaptiveThinking`, but `findProviderList`, `findAllProvidersFresh`, and `findProviderById` do not select `providers.anthropicAdaptiveThinking` at all. That means once saved, the adaptive config will come back as `undefined`/`null` after a fresh fetch and the UI/override layer can’t apply it.

Also appears in the select lists at `src/repository/provider.ts:171-231`, `src/repository/provider.ts:248-315`, and `src/repository/provider.ts:330-386`.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant