[Bug] OpenAI admin account test does not persist 429 rate-limit state, leaving stale 403 error data
Summary
The OpenAI admin account test path can return 429 usage_limit_reached, but that result is not persisted back into account runtime state in the same way as the normal rate-limit handling flow.
In practice, this can leave an account with stale persisted 403 error data in the database, while live retesting already shows 429.
Observed behavior
For some OpenAI OAuth accounts:
- persisted DB state remained:
status=errorerror_message='Access forbidden (403): account may be suspended or lack permissions'
But live /api/v1/admin/accounts/:id/test returned:
429 usage_limit_reached
This creates visible state drift between the real upstream result and the stored account status.
Root cause
In testOpenAIAccountConnection, non-200 responses are returned directly to the UI.
Currently:
401explicitly persists an account error429is returned to the caller, but does not update account runtime state through the rate-limit persistence path in this flow
Meanwhile, the rate-limit service already has logic to parse and persist OpenAI 429 reset times.
Expected behavior
When the admin test path receives an OpenAI 429 usage_limit_reached, it should persist rate-limit state consistently, including fields such as:
rate_limited_atrate_limit_reset_at
and it should avoid leaving stale 403 error data behind.
Relevant code
backend/internal/service/account_test_service.gobackend/internal/service/ratelimit_service.go
Proposed direction
We intend to help fix this by wiring the OpenAI admin test path into the existing rate-limit persistence/reconciliation flow, so retest results update runtime state instead of leaving stale error status in place.
不知是否是这个原因 openai的无法调用
用到是工具是https://github.com/NanmiCoder/cc-haha