feat(scheduler): add group priority and tiered retry fallback - #825
Conversation
Add signed group priority with a backward-compatible zero default. Select the highest eligible tier before route-mode preference, affinity and weighted rotation, then descend on retry without resetting the shared attempt budget. Preserve bound sessions and refresh replay, recalibrate priority edits with revision-safe pending admission, and expose priority in both management UIs. Add migration 0029 with SQLite and external database contract coverage. Validation: make check and focused scheduling, retry, affinity, API and migration regressions passed. Real MySQL/PostgreSQL validation runs in CI.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthrough组新增默认值为 0 的 int32 优先级,并通过数据库迁移、运行时配置和控制接口传递。调度器在最高可用优先级层选择候选,并在可重试失败时推进到较低层。经典版和新版界面新增优先级创建、编辑、校验及展示;路由检查界面也展示优先级层信息。 Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Clearing a group's priority in the classic settings form can silently reset it to zero and change which upstream receives traffic. Fix the input handling before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Routing changes remain restricted to administrators, and inspected retry paths retain existing access and identity limits. No new security bypass was established. Cross-database upgrade validation and deployment rollback assumptions remain unconfirmed. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 4.26% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 47 functions across 48 files. (11 skipped: 11 unsupported.)
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: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: QUIET
- Plan: Advanced
- Run ID:
0ea55332-73bb-4deb-829a-24c1d1a92df0
📒 Files selected for processing (59)
internal/control/group_collection.gointernal/control/group_create.gointernal/control/group_idempotency.gointernal/control/group_priority_test.gointernal/control/group_settings.gointernal/control/group_update.gointernal/control/modern_groups.gointernal/control/route_inspect.gointernal/gateway/handler.gointernal/gateway/handler_test.gointernal/gateway/live.gointernal/gateway/mistral_realtime.gointernal/gateway/priority_retry_test.gointernal/gateway/websocket_priority_test.gointernal/gateway/websocket_turn.gointernal/scheduler/fair.gointernal/scheduler/inspect.gointernal/scheduler/priority_test.gointernal/scheduler/scheduler.gointernal/state/loader/loader.gointernal/state/scheduling.gointernal/state/snapshot.gointernal/storage/database_integration_test.gointernal/storage/db_test.gointernal/storage/group_priority_migration_test.gointernal/storage/migration.gointernal/storage/migration_test.gointernal/storage/migrations/0003_remove_observation_fresh_until_test.gointernal/storage/migrations/0029_group_priority.gointernal/storage/models/group.goweb/src/frontends/classic/api/control/types.tsweb/src/frontends/classic/app/resources/groups.tsweb/src/frontends/classic/app/resources/route-inspection.tsweb/src/frontends/classic/features/groups/GroupsView.vueweb/src/frontends/classic/features/groups/settings/GroupSettingsBaseForm.vueweb/src/frontends/classic/features/groups/settings/GroupSettingsTab.vueweb/src/frontends/classic/features/groups/settings/group-settings-patch.tsweb/src/frontends/classic/features/import/ImportConnectionSection.vueweb/src/frontends/classic/features/import/NewGroupImport.vueweb/src/frontends/classic/features/import/import-recovery.tsweb/src/frontends/classic/features/import/model-draft.tsweb/src/frontends/classic/features/monitor/InspectorTab.vueweb/src/frontends/classic/i18n/locales/en-US/group.tsweb/src/frontends/classic/i18n/locales/en-US/monitor.tsweb/src/frontends/classic/i18n/locales/ja-JP/group.tsweb/src/frontends/classic/i18n/locales/ja-JP/monitor.tsweb/src/frontends/classic/i18n/locales/zh-CN/group.tsweb/src/frontends/classic/i18n/locales/zh-CN/monitor.tsweb/src/frontends/modern/api/group-create.tsweb/src/frontends/modern/api/groups.tsweb/src/frontends/modern/api/inspector.tsweb/src/frontends/modern/features/groups/GroupBasicsForm.vueweb/src/frontends/modern/features/groups/GroupCreatePanel.vueweb/src/frontends/modern/features/groups/GroupListRow.vueweb/src/frontends/modern/features/groups/GroupsView.vueweb/src/frontends/modern/features/inspector/RouteInspector.vueweb/src/frontends/modern/features/inspector/inspection-display.tsweb/src/frontends/modern/i18n/locales/groups.tsweb/src/shared/group-priority.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.
关联 Issue / Related Issue
Closes #613
变更内容 / Change Content
Add signed group priority to support preferred and backup upstreams. Higher values run first; the default of
0preserves existing scheduling when all groups share a tier.0029_group_priorityfor SQLite, MySQL and PostgreSQL; existing groups receive0, and default create-request idempotency remains compatible.The retry policy deliberately skips untried peers in higher tiers to reach backups sooner. Priority edits can change relative scheduling history across all credentials. Local concurrency, RPM and quota rejection rules remain unchanged.
Validation:
make checkpassed, including the complete Go suite, frontend lint, type checks and builds. Added scheduling, retry-budget, affinity/binding, API/idempotency and migration regressions. Real MySQL/PostgreSQL migration validation is covered by the existing CI matrix and remains pending.The design specification was updated locally under the intentionally ignored
docs/directory. No public documentation or release notes were changed.自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。 / I ranmake check, or documented why it could not run and what remains unverified.