FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(health): Add configurable upstream error rules by tbphp · Pull Request #830 · tbphp/gpt-load · GitHub

Repository navigation

feat(health): Add configurable upstream error rules - #830

Open
tbphp wants to merge 2 commits into
mainfrom
tbphp/custom-error-rules
Open

tbphp wants to merge 2 commits into
mainfrom
tbphp/custom-error-rules

Conversation

tbphp commented Oct 6, 2026

Copy link
Copy Markdown
Owner

关联 Issue / Related Issue

Refs #753

变更内容 / Change Content

  • Bug fix
  • New feature
  • Other changes

Allow operators to configure how existing upstream errors are handled. Rules match HTTP status codes and case-insensitive keywords in error codes, types, or messages, then select a retry directive and one state action: no change, model cooldown, credential cooldown, failure counting toward blacklisting, or skipping the group for the current request.

  • Add global defaults and complete group overrides. An explicit empty group list suppresses global rules, and the first matching rule applies.
  • Reuse the existing decision and execution pipeline, blacklist threshold, and configuration snapshots. Preserve replay safety, client-error and authentication boundaries, and committed-response constraints.
  • Add rule editors and readable matched-rule labels to both frontends, with Chinese, English, and Japanese translations.

Rules only use existing error evidence, including errors already recognized under HTTP 200. New non-streaming 2xx error detection and scanning normal answer text remain outside this change. Credential probes and recovery behavior are unchanged. No schema migration or new dependency is required.

Validation: make check covers Go vet, frontend lint/style/format checks, TypeScript checks, builds, and go test -count=1 . ./internal/.... New backend regression tests cover matching, first-match priority, inheritance and empty overrides, replay constraints, failure counting, cooldown, and request-log decisions.

自查清单 / Checklist

  • I ran make check, or documented why it could not run and what remains unverified.
  • This PR is focused and contains no unrelated changes.
  • I updated any required public documentation or release notes.
  • I confirmed that commits, logs, and fixtures contain no sensitive data.
  • Where applicable, I documented compatibility or data-migration impact.

Public documentation and release notes are unchanged; no documentation update is included in this PR.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 13:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

coderabbitai Bot commented Oct 6, 2026 •
edited
Loading

Copy link
Copy Markdown

📝 Walkthrough

Walkthrough

新增全局和分组自定义错误规则。后端负责校验、继承和应用规则,并将分组规则传入网关健康决策。经典版和现代版前端新增规则配置、编辑、验证及日志标识展示。

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to bcdf6

Entering a cooldown in the modern rule editor can prevent the rule from updating. Fix that editing path before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 35 files. (9 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题简洁明确,准确概括了新增可配置的上游错误规则这一主要变更。
Description check ✅ Passed 描述包含关联 Issue、变更内容、验证范围、自查清单及兼容性说明。文档与发布说明未更新的原因也已注明。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 2.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 35 files. (9 skipped: 9 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
web/src/frontends/modern/features/config/ErrorRulesEditor.vue-142-190 (1)

142-190: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

将现代编辑器的 cooldown 更新值转换为字符串。

现代 AppTextField 的 number 输入会将可解析值写为数字。随后 errorRuleValue 对 row.cooldown 调用 trim(),会抛出类型错误并阻断现代编辑器更新规则。经典编辑器发送字符串,不受此问题影响。

建议修复
-          v-model="row.cooldown"
+          :model-value="row.cooldown"
+          @update:model-value="row.cooldown = String($event)"

ℹ️ Review info ⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 47480bf5-4dd9-46ad-a09f-0b9f3ec5e50c
📥 Commits

Reviewing files that changed from the base of the PR and between a5c691b and bcdf661.

📒 Files selected for processing (44)
  • internal/control/error_rules_test.go
  • internal/control/group_detail.go
  • internal/control/group_settings.go
  • internal/control/settings.go
  • internal/gateway/custom_error_rules_test.go
  • internal/gateway/handler.go
  • internal/gateway/jev_decision.go
  • internal/gateway/live.go
  • internal/gateway/mistral_realtime.go
  • internal/gateway/websocket_turn.go
  • internal/health/decision.go
  • internal/health/error_rules.go
  • internal/health/error_rules_test.go
  • internal/health/execution_judge.go
  • internal/state/error_rules_test.go
  • internal/state/runtime_settings.go
  • internal/state/snapshot.go
  • web/src/frontends/classic/api/control/types.ts
  • web/src/frontends/classic/app/resources/groups.ts
  • web/src/frontends/classic/app/resources/settings.ts
  • web/src/frontends/classic/components/config/ErrorRulesEditor.vue
  • web/src/frontends/classic/features/groups/group-route.ts
  • web/src/frontends/classic/features/groups/settings/GroupSettingsTab.vue
  • web/src/frontends/classic/features/groups/settings/group-settings-patch.ts
  • web/src/frontends/classic/features/monitor/LogDetailDrawer.vue
  • web/src/frontends/classic/features/settings/ReliabilitySettingsSection.vue
  • web/src/frontends/classic/features/settings/SettingsView.vue
  • web/src/frontends/classic/features/settings/settings-patch.ts
  • web/src/frontends/classic/i18n/locales/en-US/core.ts
  • web/src/frontends/classic/i18n/locales/ja-JP/core.ts
  • web/src/frontends/classic/i18n/locales/zh-CN/core.ts
  • web/src/frontends/modern/api/group-detail.ts
  • web/src/frontends/modern/api/settings.ts
  • web/src/frontends/modern/features/config/ErrorRulesEditor.vue
  • web/src/frontends/modern/features/groups/GroupAdvancedPanel.vue
  • web/src/frontends/modern/features/logs/LogDetailPanel.vue
  • web/src/frontends/modern/features/settings/SettingsView.vue
  • web/src/frontends/modern/features/settings/settings-draft.ts
  • web/src/frontends/modern/features/settings/use-settings-editor.ts
  • web/src/frontends/modern/i18n/locales/en-US.ts
  • web/src/frontends/modern/i18n/locales/ja-JP.ts
  • web/src/frontends/modern/i18n/locales/zh-CN.ts
  • web/src/shared/error-rule-messages.ts
  • web/src/shared/error-rules.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

tbphp commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Addressed the cooldown input issue in ef85c66: the modern rule editor converts numeric input updates to strings before parsing. The same commit omits empty optional condition arrays when reading rules, so editing and then restoring a rule no longer leaves settings marked as changed. make check passed.

The docstring coverage warning in the review summary is not a quality gate defined by this repository, so no bulk docstring changes are included.

tbphp self-assigned this Oct 7, 2026
tbphp added the enhancement New feature or request label Oct 7, 2026
tbphp added this to the v2.0.0 milestone Oct 7, 2026

This branch has not been deployed

No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL