feat(channels): add auto-disable-only channel test mode - #6728
Conversation
WalkthroughThe PR adds ChangesAuto-ban-only channel testing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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.
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)
web/src/features/system-settings/models/routing-reliability-section.tsx (1)
461-485: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUpdate the test-interval description for the new
auto_ban_onlymode.The
auto_test_channel_minutesfield description only distinguishespassive_recoveryfrom every other mode. Forauto_ban_only, it still shows "How frequently the system tests all channels", butauto_ban_onlytests only channels with auto-disable enabled, not all channels. Align this description with the three-waychannelTestModeDescriptionswitch added above.🐛 Proposed fix for the test-interval description
+ <FormDescription> + {(() => { + switch (channelTestMode) { + case 'passive_recovery': + return t( + 'How frequently the system checks auto-disabled channels for recovery' + ) + case 'auto_ban_only': + return t( + 'How frequently the system tests auto-disable-enabled channels' + ) + default: + return t('How frequently the system tests all channels') + } + })()} + </FormDescription> - <FormDescription> - {channelTestMode === 'passive_recovery' - ? t( - 'How frequently the system checks auto-disabled channels for recovery' - ) - : t('How frequently the system tests all channels')} - </FormDescription>🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/features/system-settings/models/routing-reliability-section.tsx` around lines 461 - 485, Update the auto_test_channel_minutes FormDescription in the routing reliability section to reuse the existing channelTestModeDescription three-way logic, ensuring auto_ban_only describes testing only auto-disabled channels, passive_recovery retains its recovery wording, and other modes retain the all-channels wording.
🧹 Nitpick comments (1)
web/src/i18n/locales/en.json (1)
517-518: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueRemove unreachable translation keys or wire them into the settings UI.
web/src/features/system-settings/models/routing-reliability-section.tsxcurrently uses free-text labels for the auto-disable probe description and the recovery interval. If these strings must become translatable, replace the hardcoded labels witht(...). If not, remove these unused values from all locale JSON files to avoid stale translations.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/i18n/locales/en.json` around lines 517 - 518, Update web/src/features/system-settings/models/routing-reliability-section.tsx to pass the auto-disable probe description and recovery interval labels through the existing t(...) translation function, using the matching locale keys. Apply the corresponding translation-key updates in web/src/i18n/locales/en.json lines 517-518 and 3684, and web/src/i18n/locales/fr.json lines 517-518 and 3684; remove any keys that remain unused instead of retaining stale entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/i18n/locales/ja.json`:
- Around line 154-155: Update the Japanese translations for “Actively check all
channels” and “Actively check auto-disable-enabled channels” to use wording that
conveys active probing, such as 能動的にチェック, instead of 定期チェック. Leave the separate
periodic-check descriptions unchanged.
In `@web/src/i18n/locales/ru.json`:
- Around line 517-518: Standardize the Russian translations for the two
auto-disable locale entries by replacing the inconsistent terms in
“Auto-disable-enabled channels only” and “Auto-disable-enabled mode probes
non-manually-disabled channels with auto-disable enabled.” with the established
“автоотключение” terminology, preserving the existing meaning.
---
Outside diff comments:
In `@web/src/features/system-settings/models/routing-reliability-section.tsx`:
- Around line 461-485: Update the auto_test_channel_minutes FormDescription in
the routing reliability section to reuse the existing channelTestModeDescription
three-way logic, ensuring auto_ban_only describes testing only auto-disabled
channels, passive_recovery retains its recovery wording, and other modes retain
the all-channels wording.
---
Nitpick comments:
In `@web/src/i18n/locales/en.json`:
- Around line 517-518: Update
web/src/features/system-settings/models/routing-reliability-section.tsx to pass
the auto-disable probe description and recovery interval labels through the
existing t(...) translation function, using the matching locale keys. Apply the
corresponding translation-key updates in web/src/i18n/locales/en.json lines
517-518 and 3684, and web/src/i18n/locales/fr.json lines 517-518 and 3684;
remove any keys that remain unused instead of retaining stale entries.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9879a721-a8c0-420e-bb50-6aebb4cf4b39
📒 Files selected for processing (13)
controller/channel-test.gocontroller/channel_test_internal_test.gosetting/operation_setting/monitor_setting.gosetting/operation_setting/monitor_setting_test.goweb/src/features/system-settings/models/routing-reliability-section.tsxweb/src/features/system-settings/types.tsweb/src/i18n/locales/en.jsonweb/src/i18n/locales/fr.jsonweb/src/i18n/locales/ja.jsonweb/src/i18n/locales/ru.jsonweb/src/i18n/locales/vi.jsonweb/src/i18n/locales/zh-TW.jsonweb/src/i18n/locales/zh.json
| "Actively check all channels": "すべてのチャネルを定期チェック", | ||
| "Actively check auto-disable-enabled channels": "自動無効化が有効なチャネルを定期チェック", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve the distinction between active and periodic checks.
The Japanese value 定期チェック means “periodically check,” not “actively check.” The same wording is already used for the separate periodic-check descriptions at Lines 3367-3368. Use wording such as 能動的にチェック so users can distinguish active probing from periodic scheduling.
Proposed fix
- "Actively check all channels": "すべてのチャネルを定期チェック",
- "Actively check auto-disable-enabled channels": "自動無効化が有効なチャネルを定期チェック",
+ "Actively check all channels": "すべてのチャネルを能動的にチェック",
+ "Actively check auto-disable-enabled channels": "自動無効化が有効なチャネルを能動的にチェック",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "Actively check all channels": "すべてのチャネルを定期チェック", | |
| "Actively check auto-disable-enabled channels": "自動無効化が有効なチャネルを定期チェック", | |
| "Actively check all channels": "すべてのチャネルを能動的にチェック", | |
| "Actively check auto-disable-enabled channels": "自動無効化が有効なチャネルを能動的にチェック", |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/i18n/locales/ja.json` around lines 154 - 155, Update the Japanese
translations for “Actively check all channels” and “Actively check
auto-disable-enabled channels” to use wording that conveys active probing, such
as 能動的にチェック, instead of 定期チェック. Leave the separate periodic-check descriptions
unchanged.
| "Auto-disable-enabled channels only": "Только каналы с автовыключением", | ||
| "Auto-disable-enabled mode probes non-manually-disabled channels with auto-disable enabled.": "В этом режиме проверяются только каналы с включённым автоматическим отключением, которые не были отключены вручную.", |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Standardize the Russian term for auto-disable.
Lines 517-518 use автовыключение and автоматическое отключение for the same setting. Other entries use автоотключение. Use one term so the mode has consistent wording.
Proposed wording
- "Auto-disable-enabled channels only": "Только каналы с автовыключением",
- "Auto-disable-enabled mode probes non-manually-disabled channels with auto-disable enabled.": "В этом режиме проверяются только каналы с включённым автоматическим отключением, которые не были отключены вручную.",
+ "Auto-disable-enabled channels only": "Только каналы с автоотключением",
+ "Auto-disable-enabled mode probes non-manually-disabled channels with auto-disable enabled.": "В этом режиме проверяются только каналы с включённым автоотключением, которые не были отключены вручную.",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "Auto-disable-enabled channels only": "Только каналы с автовыключением", | |
| "Auto-disable-enabled mode probes non-manually-disabled channels with auto-disable enabled.": "В этом режиме проверяются только каналы с включённым автоматическим отключением, которые не были отключены вручную.", | |
| "Auto-disable-enabled channels only": "Только каналы с автоотключением", | |
| "Auto-disable-enabled mode probes non-manually-disabled channels with auto-disable enabled.": "В этом режиме проверяются только каналы с включённым автоотключением, которые не были отключены вручную.", |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/i18n/locales/ru.json` around lines 517 - 518, Standardize the Russian
translations for the two auto-disable locale entries by replacing the
inconsistent terms in “Auto-disable-enabled channels only” and
“Auto-disable-enabled mode probes non-manually-disabled channels with
auto-disable enabled.” with the established “автоотключение” terminology,
preserving the existing meaning.
* fix(relay): set Request.GetBody so the HTTP/2 transport can transparently retry after an upstream stream reset (QuantumNous#6249) * fix(relay): set Request.GetBody so the HTTP/2 transport can transparently retry after an upstream stream reset The outbound request body is a type-erased io.Reader over BodyStorage, so net/http cannot derive Request.GetBody (it only does so for *bytes.Reader, *bytes.Buffer and *strings.Reader). With GetBody nil, the HTTP/2 transport cannot transparently retry a request once the body has been written and the upstream resets the stream with a retryable error (REFUSED_STREAM, or a connection-level GOAWAY); the relay request then fails with: http2: Transport: cannot retry err [...] after Request.Body was written; define Request.GetBody to avoid this error This affects every relay path that goes through DoApiRequest (chat, claude, gemini, responses, embedding, image, rerank). BodyStorage (memory and disk) already implements io.Seeker, so replay support only needed wiring: - NewOutboundJSONBody additionally returns a getBody that rewinds the storage and hands out a fresh non-closing reader. The transport only calls GetBody after the previous attempt's body has been abandoned, so the rewind cannot race an in-flight read. - RelayInfo carries it in the new UpstreamRequestGetBody field, set alongside UpstreamRequestBodySize by the handlers that build storage-backed bodies. - applyUpstreamGetBody (symmetric with applyUpstreamContentLength) wires it into DoApiRequest/DoFormRequest/DoTaskApiRequest, only when req.GetBody is still nil. Also remove the hand-rolled GetBody override in DoTaskApiRequest: it returned the same already-consumed reader, so any transport-level replay would have silently sent an empty body, and it clobbered the correct snapshot-based GetBody that net/http derives from the *bytes.Reader bodies the task adaptors pass in. For non-replayable bodies GetBody now stays nil, so a retry fails loudly instead of corrupting the request. Covered by unit tests plus an end-to-end raw-frame HTTP/2 test that resets the first stream with REFUSED_STREAM after the body is written and asserts the transport transparently retries with the complete body. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(relay): hand out independent readers from GetBody (address review) Per the http.Request.GetBody contract ("returns a new copy of Body"), each call must yield a reader with its own cursor. The previous implementation rewound and reused the shared BodyStorage, so two consecutive GetBody readers would interfere with each other, and a replay could disturb the primary body's offset under extreme transport timing (e.g. attempt N's body write not yet fully abandoned when the transport builds attempt N+1). Instead of snapshotting the payload (an extra copy), add BodyStorage.NewReader, which returns an independent zero-copy reader: - memory mode: a fresh bytes.Reader over the same immutable backing array; - disk mode: a separate file descriptor over the cache file, so the transport closing a replayed body only closes that descriptor. NewOutboundJSONBody's getBody now simply hands out storage.NewReader, and once the handler releases the storage, GetBody fails with ErrStorageClosed instead of replaying stale data. Tests: interleaved reads across two replay readers and the primary body each observe exactly their own byte stream, for both the memory and the disk-backed storage; the existing GetBody and HTTP/2 retry suites still pass (h2 e2e tests flake-free with -count=20). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(relay): bind replayable metadata on pass-through requests * fix(relay): reset upstream body metadata between channels * test(relay): cover replay across retries and channel attempts * fix(relay): stop following upstream redirects --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * refactor(relay): move replay metadata onto request bodies * Merge commit from fork * feat(channels): refine fetched model categorization (QuantumNous#6632) * feat(channels): refine fetched model categorization * fix: channel category * fix: hy3 category * fix: test Claude/Gemini endpoints with native request format (QuantumNous#6698) * feat(rate-limit): add user critical rate limit middleware for access token and aff transfer routes * fix: 修复兑换码额度精度损失 (QuantumNous#6685) * fix: 修复兑换码额度精度损失(QuantumNous#6680) * fix(redemption): guard update data integrity * CI: enhance release synchronization workflow with optional file syncing * fix(ali): stop injecting top_p into requests that omit it (QuantumNous#6674) * fix(channels): classify Qwen TTS models correctly (QuantumNous#6711) * feat(channels): add auto-disable-only channel test mode (QuantumNous#6728) * perf(web): debounce server and large-list searches (QuantumNous#6727) * fix: record reasoning effort consistently in usage logs (QuantumNous#6641) * feat(relay): expose user and group context to parameter overrides (QuantumNous#6534) * fix(ollama): preserve reasoning and tool-call context (QuantumNous#6605) * fix: backend length validation (QuantumNous#5548) * feat(billing): highlight matched conditional multipliers in logs (QuantumNous#6561) * feat(billing): highlight matched conditional multipliers in usage logs * fix(billing): make request rule tracing stable and type-safe * fix(web): require confirmation before rotating access token (QuantumNous#6749) --------- Co-authored-by: Lucas <hepo.lucas@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: CaIon <i@caion.me> Co-authored-by: RedwindA <128586631+RedwindA@users.noreply.github.com> Co-authored-by: Seefs <40468931+seefs001@users.noreply.github.com> Co-authored-by: lihu-001 <lihu9048@gmail.com> Co-authored-by: ENCHIGO <38551565+ENCHIGO@users.noreply.github.com>
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
修改渠道自动测试模式文案,增加测试 仅开启自动禁用渠道 测试模式
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit
New Features
Bug Fixes