Files
codex-proxy-rs/backend/migrations/0034_account_error_protection.sql
T
736eca6593 feat(accounts): support configurable error protection rules (#547)
* feat(accounts): support configurable error protection rules

Replace capacity-specific freezing with bounded, configurable account error rules and shared attempt feedback.

Drop legacy settings without conversion and expose rule editing and freeze reasons in the admin UI.

Co-authored-by: Codex <noreply@openai.com>

* fix(accounts): preserve error protection scheduling boundaries

Keep xAI accounts excluded while recovery probes are pending, and cover
selection before and after recovery.

Separate scheduling cooldown reads from admin display details, share the
atomic Redis migration and selection logic, and use one policy revision.
Remove the unused adaptive concurrency reduction path and its tests.

Validation: 393 targeted backend tests, workspace Clippy with -D warnings,
Rustfmt, frontend type checking and build, and local service health checks.

Co-authored-by: Codex <noreply@openai.com>

---------

Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
2026-10-28 21:50:51 +08:00

14 lines
921 B
SQL

-- 新安装与升级均从关闭且无规则开始,不继承旧保护配置
alter table runtime_settings add column account_error_protection_json jsonb not null default '{"enabled":false,"rules":[],"threshold":12,"windowSeconds":600,"durationSeconds":7200,"probeEnabled":true,"probeModel":null}'::jsonb;
alter table runtime_settings
drop column account_auto_freeze_enabled,
drop column account_auto_freeze_threshold,
drop column account_auto_freeze_window_seconds,
drop column account_auto_freeze_duration_seconds,
drop column account_auto_freeze_probe_enabled,
drop column account_auto_freeze_probe_model,
drop column account_auto_freeze_adaptive_concurrency;
alter table runtime_settings add column account_error_protection_revision bigint not null default 1 check (account_error_protection_revision > 0);
update runtime_settings set account_error_protection_revision = config_revision;