closed: accidental submission#1310
Conversation
- persist reasoning_output_tokens through message_request and usage_ledger - expose reasoning tokens in dashboard logs, my-usage summary, exports, and detail dialogs - add migration, backfill, and test coverage for reasoning/thinking token handling
- Move Node.js instrumentation code to dedicated module - Create edge instrumentation entrypoint as Edge-safe stub - Refactor main instrumentation to dispatch by runtime - Replace `node:net` imports with custom IP parser for portability
- Set NODE_ENV to production for production runtime behavior
- Show reasoning tokens inline after output tokens when present - Add short localization keys for compact tooltip labels - Update tooltip to display reasoning tokens in indented section - Add helper function and tests for new rendering behavior
- Refactor sumUserCostToday to use user-specific daily reset time and mode - Implement GLM MCP client error handling with auth error detection - Replace console methods with development-only logger in error translation utilities - Improve test setup with error suppression and environment readiness helpers - Add unit tests for GLM error handling and statistics daily cost query - Fix component test to wrap switch click in act for proper async handling
- Add `retryOnMatch` field to error rule schema, database, and API - Add "Auto Retry on Match" toggle in add and edit rule dialogs - Update proxy forwarder to retry matched errors when flag is set - Add detection and repository support for the new field - Add tests and translations for all supported locales
- Update package.json version to 0.8.7 - Set VERSION file to 0.8.7+cch.1
- Strip +build metadata before version comparison and calculation - Preserve +cch.X suffix when writing VERSION file after release - Sync VERSION to 0.8.9+cch.1 and package.json to 0.8.9
…serve +cch.X suffix
- Replace reasoningTokens key with reasoningShort across all log components - Bump version to 0.8.8.2
- Add reasoning_effort special setting type and dual-path extraction - Detect provider override on effort and show transition in tooltips - Display inline effort badge in model column with detailed tooltip - Update i18n messages for reasoning effort labels and tooltips - Populate reasoningEffort field in usage log queries
- Remove deprecated usage-logs-table component and its translations - Drop anthropicEffort field; consolidate on reasoningEffort - Refactor model display component for cleaner reasoning effort logic - Clean up unused translation keys across all locales
- Add reasoning effort badge and expanded model tooltip to dashboard/logs - Unify generic naming and retain legacy audit compatibility in reasoning effort - Remove unused legacy logs table and clean unused copy/types in my-usage
- Set `generate_release_notes` to true for auto-generated notes
- Introduce CompactMetricRows component for token, cache, and performance columns - Add i18n metric labels (input, output, reasoning, cacheWrite/Read, duration, ttfb, rate) across all locales - Display empty dash when no token values are present - Refactor tooltips to use popover variant and updated theming classes - Update tests to assert new metric row structure and popover variant
- Add short effort labels for compact mobile display - Move effort badge and redirect badge to separate row on mobile - Adjust column widths and row height to accommodate new layout - Bump version 0.8.8.5
- Add reasoning tokens column with inline display and tooltip - Introduce layoutVariant prop to support compact fullscreen mode - Restructure table columns: move status first, add absolute time, highlight error rows - Add i18n translations for new column headers in all supported locales - Extract cell rendering functions for better maintainability
- Make `label` property optional in `CompactMetricRow` interface - Conditionally render grid layout and label span when label is present - Remove label from cache-read row to show only the value - Update test to verify cache read row is value-only
- Redesign badge colors from warm to cool-toned scale for each effort level - Switch desktop effort label to short i18n key - Adjust test assertions to match new badge rendering - Add unit tests for badge class name generation
- update effort badge color scheme - make metric row labels optional - Increment development version from 0.8.8.6 to 0.8.8.7
- Relocate Anthropic effort badge from Session Info to Model Audit section in error details dialog - Wrap effort badge in span container with data-slot attribute for consistent layout - Add overridden effort display logic for provider-applied effort differences - Update tests to verify new positioning and data-slot attributes
- Reduce flex basis and min-width for user/key column for better layout - Bump version to 0.8.8.9
- Add deepseek provider type across schemas, DB, API, proxy, and UI - Add reasoning effort override setting with inherit/high/max options - Support dual protocol (OpenAI and Anthropic formats) for DeepSeek V4 - Add i18n strings, testing presets, and provider configurations - Update README and docs to include DeepSeek in provider list
- Add deepseek to provider type enum across API types, schemas, and constants - Implement DeepSeek reasoning effort override with format-aware detection - Add localization strings and UI filter for DeepSeek-specific settings - Add tests for overrides, validation, effort extraction, and test prompts
…effort feat(providers): add DeepSeek provider type with reasoning effort
- add an include-non-billing filter to dashboard logs and my-usage - surface internal endpoint badges in logs and session request views - update usage log queries, OpenAPI types, and readonly tests for the new visibility flow
|
Important Review skippedToo many files! This PR contains 225 files, which is 75 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (225)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f1ff0fb19
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // DeepSeek reasoning effort override (only for deepseek providers) | ||
| // - 'inherit': follow client request (default) | ||
| // - 'high'/'max': force override reasoning_effort | ||
| deepseekReasoningEffortPreference: varchar('deepseek_reasoning_effort_preference', { length: 20 }), |
There was a problem hiding this comment.
Add a migration for the DeepSeek provider column
This schema adds providers.deepseek_reasoning_effort_preference, and the repository now selects it from providers, but neither new migration adds that column to the providers table (the new SQL only adds token columns and error_rules.retry_on_match). On any existing database that applies these migrations, provider queries will fail with a missing-column error as soon as this field is selected or updated.
Useful? React with 👍 / 👎.
| case "claude": | ||
| return providerType === "claude" || providerType === "claude-auth"; | ||
| return ( | ||
| providerType === "claude" || providerType === "claude-auth" || providerType === "deepseek" |
There was a problem hiding this comment.
Include DeepSeek in auth header handling
Once this compatibility check allows a deepseek provider to be selected for proxy traffic, the request still goes through the standard buildHeaders path, but that path only sets Authorization: Bearer ... for codex and openai-compatible provider types. In a deployment with a DeepSeek provider configured, selected DeepSeek requests will be sent upstream without the provider key and will fail authentication.
Useful? React with 👍 / 👎.
| // 确保即使 maxAttemptsPerProvider=1 也能完成一次额外重试 | ||
| maxAttemptsPerProvider = Math.max(maxAttemptsPerProvider, attemptCount + 1); |
There was a problem hiding this comment.
When a retry-on-match rule keeps matching a deterministic upstream/client error, this assignment runs on every failed attempt and raises maxAttemptsPerProvider to attemptCount + 1 each time. The later provider-error branch therefore always sees attemptCount < maxAttemptsPerProvider and continues retrying the same provider indefinitely instead of ever exhausting attempts or switching providers.
Useful? React with 👍 / 👎.
| async function findMessageRequestUsageLogStats( | ||
| filters: Omit<UsageLogFilters, "page" | "pageSize">, | ||
| options: { nonBillingOnly?: boolean } = {} | ||
| ): Promise<UsageLogSummary> { | ||
| const { userId, keyId, providerId } = filters; | ||
| const conditions = [isNull(messageRequest.deletedAt), EXCLUDE_WARMUP_CONDITION]; | ||
|
|
||
| if (userId !== undefined) { | ||
| conditions.push(eq(messageRequest.userId, userId)); | ||
| } | ||
|
|
||
| if (keyId !== undefined) { | ||
| conditions.push(eq(keysTable.id, keyId)); | ||
| } | ||
|
|
||
| if (providerId !== undefined) { | ||
| conditions.push(eq(messageRequest.providerId, providerId)); | ||
| } | ||
|
|
||
| conditions.push(...buildUsageLogConditions(filters)); | ||
|
|
||
| if (options.nonBillingOnly) { | ||
| conditions.push(buildNonBillingUsageLogEndpointCondition(messageRequest.endpoint)); | ||
| } | ||
|
|
||
| const baseQuery = db | ||
| .select({ | ||
| totalRequests: sql<number>`count(*)::double precision`, | ||
| totalCost: sql<string>`0`, | ||
| totalInputTokens: sql<number>`COALESCE(sum(${messageRequest.inputTokens})::double precision, 0::double precision)`, | ||
| totalOutputTokens: sql<number>`COALESCE(sum(${messageRequest.outputTokens})::double precision, 0::double precision)`, | ||
| totalReasoningOutputTokens: sql<number>`COALESCE(sum(${messageRequest.reasoningOutputTokens})::double precision, 0::double precision)`, | ||
| totalCacheCreationTokens: sql<number>`COALESCE(sum(${messageRequest.cacheCreationInputTokens})::double precision, 0::double precision)`, | ||
| totalCacheReadTokens: sql<number>`COALESCE(sum(${messageRequest.cacheReadInputTokens})::double precision, 0::double precision)`, | ||
| totalCacheCreation5mTokens: sql<number>`COALESCE(sum(${messageRequest.cacheCreation5mInputTokens})::double precision, 0::double precision)`, | ||
| totalCacheCreation1hTokens: sql<number>`COALESCE(sum(${messageRequest.cacheCreation1hInputTokens})::double precision, 0::double precision)`, | ||
| }) | ||
| .from(messageRequest); | ||
|
|
||
| const query = | ||
| keyId !== undefined | ||
| ? baseQuery.innerJoin(keysTable, eq(messageRequest.key, keysTable.key)) | ||
| : baseQuery; | ||
|
|
||
| const [summaryResult] = await query.where(and(...conditions)); | ||
|
|
||
| return buildUsageLogSummaryFromAggregates(summaryResult); | ||
| } |
There was a problem hiding this comment.
Missing date-range and session filters in non-billing stats query
findMessageRequestUsageLogStats builds its WHERE clause from userId, keyId, providerId, and the shared buildUsageLogConditions helper — but it never adds conditions for filters.startTime, filters.endTime, or filters.sessionId. buildUsageLogConditions only handles model/statusCode/endpoint/retryCount (see UsageLogFilterParams); date range and session are not in scope.
findBillableUsageLogStats (the ledger path) does apply all three of these filters. As a result, when a user enables Include non-billing endpoints while a date range or session filter is also active, the merged summary will add non-billing token counts from all time / all sessions to the correctly scoped billable totals. The stats panel will silently show inflated numbers.
The same gap exists in the isNonBillingEndpoint short-circuit path (pre-existing), but the new includeMixedStats branch makes it reachable whenever any user toggles the new switch alongside a date or session filter.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/repository/usage-logs.ts
Line: 1625-1672
Comment:
**Missing date-range and session filters in non-billing stats query**
`findMessageRequestUsageLogStats` builds its `WHERE` clause from `userId`, `keyId`, `providerId`, and the shared `buildUsageLogConditions` helper — but it never adds conditions for `filters.startTime`, `filters.endTime`, or `filters.sessionId`. `buildUsageLogConditions` only handles model/statusCode/endpoint/retryCount (see `UsageLogFilterParams`); date range and session are not in scope.
`findBillableUsageLogStats` (the ledger path) **does** apply all three of these filters. As a result, when a user enables **Include non-billing endpoints** while a date range or session filter is also active, the merged summary will add non-billing token counts from **all time / all sessions** to the correctly scoped billable totals. The stats panel will silently show inflated numbers.
The same gap exists in the `isNonBillingEndpoint` short-circuit path (pre-existing), but the new `includeMixedStats` branch makes it reachable whenever any user toggles the new switch alongside a date or session filter.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Code Review
This pull request introduces support for DeepSeek as a provider, along with comprehensive tracking and auditability of reasoning/thinking tokens across the dashboard logs, statistics panels, and exported files. It adds a reasoning_output_tokens column to the database (message_request and usage_ledger tables) and implements a retry_on_match flag for error rules to trigger automatic retries on transient errors. The virtualized logs table has also been refactored to support default and fullscreen layout variants. The code review feedback highlights several missing translation keys in the locale files, specifically cacheRead and cacheWrite under logs.columns, and billingDetails.unit.tokens under billingDetails.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| "inputOutputTokens": "Input / Output", | ||
| "reasoningTokens": "Reasoning", | ||
| "latency": "Latency" |
There was a problem hiding this comment.
The translation keys cacheRead and cacheWrite are used under logs.columns in virtualized-logs-table.tsx but are missing from the translation files. Please add them to dashboard.json across all locales.
"inputOutputTokens": "Input / Output",
"reasoningTokens": "Reasoning",
"latency": "Latency",
"cacheRead": "Cache Read",
"cacheWrite": "Cache Write"| "reasoningTokens": "Reasoning Tokens", | ||
| "reasoningShort": "Reasoning", | ||
| "includedInOutput": "Already included in output tokens", | ||
| "includedInOutputShort": "Included in output", |
There was a problem hiding this comment.
The translation key billingDetails.unit.tokens is used in MetadataTab.tsx and SummaryTab.tsx but is missing from the translation files. Please add the unit object with the tokens key to dashboard.json across all locales.
| "reasoningTokens": "Reasoning Tokens", | |
| "reasoningShort": "Reasoning", | |
| "includedInOutput": "Already included in output tokens", | |
| "includedInOutputShort": "Included in output", | |
| "reasoningTokens": "Reasoning Tokens", | |
| "reasoningShort": "Reasoning", | |
| "includedInOutput": "Already included in output tokens", | |
| "includedInOutputShort": "Included in output", | |
| "unit": { | |
| "tokens": "tokens" | |
| }, |
| <span className="text-muted-foreground">{t("billingDetails.input")}:</span> | ||
| <span className="font-mono">{formatTokenAmount(inputTokens)} tokens</span> | ||
| <span className="font-mono"> | ||
| {formatTokenAmount(inputTokens)} {t("billingDetails.unit.tokens")} |
There was a problem hiding this comment.
The translation key billingDetails.unit.tokens is used here but is completely missing from all dashboard.json translation files (messages/en/dashboard.json, messages/ja/dashboard.json, etc.). This will cause missing translation warnings or raw key strings to be displayed on the UI. Please add the missing keys to the translation files.
| <div className="flex justify-between"> | ||
| <span className="text-muted-foreground">{t("billingDetails.reasoningShort")}:</span> | ||
| <span className="font-mono"> | ||
| {formatTokenAmount(reasoningOutputTokens)} {t("billingDetails.unit.tokens")} |
| title={t("logs.columns.cacheRead")} | ||
| > | ||
| {t("logs.columns.cache")} | ||
| {t("logs.columns.cacheRead")} |
No description provided.