Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(server): honor Retry-After on 429 + abort cross-account auto-continuation#6

Open
danscMax wants to merge 1 commit into
ForgetMeAI:main from
danscMax:feat/server-resilience
Open

fix(server): honor Retry-After on 429 + abort cross-account auto-continuation #6
danscMax wants to merge 1 commit into
ForgetMeAI:main from
danscMax:feat/server-resilience

Conversation

@danscMax

@danscMax danscMax commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Two small, independent resilience fixes for rate-limit handling and auto-continuation.

#16 — honor Retry-After on 429

markAccountFailure currently applies a fixed cooldown on 429 and ignores the server's Retry-After. This reads Retry-After (both delta-seconds and HTTP-date forms) and uses it for the cooldown when present, falling back to the existing DEEPSEEK_ACCOUNT_COOLDOWN_MS otherwise. The override is gated to 429 only.

#20 — abort cross-account auto-continuation

Auto-continuation calls askDeepSeekStream('continue'). If the account rotated mid-stream (e.g. the original hit a cooldown), the continuation runs on a different account whose chat_session has no prior context — appending irrelevant text to the response. This detects the account switch and stops continuation instead.

Notes

  • askDeepSeekStream now also returns account (additive; existing destructures unaffected).
  • The 429 and rotation paths require live rate-limited accounts to exercise; verified by code review + server boot / /health.

...ntinuation
- markAccountFailure now honors a Retry-After header (delta-seconds or
 HTTP-date) on HTTP 429, falling back to the env-configured fixed cooldown
 when the header is absent or unparseable
- auto-continuation aborts when account rotation moved to a different account
 whose chat_session lacks prior context (continuation would be irrelevant)

Copy link
Copy Markdown
Author

Привет! Здесь две правки устойчивости сервера (server.js, +30/−7):

  1. Учёт заголовка Retry-After при 429. markAccountFailure теперь читает Retry-After (и формат в секундах, и HTTP-дату), ставит кулдаун ровно на запрошенное сервером время (не меньше 1 с). Если заголовка нет или он не парсится — откат на прежний фиксированный кулдаун из env. Так аккаунт не «отдыхает» дольше, чем нужно, и не долбит сервер раньше времени.
  2. Отмена авто-продолжения при ротации аккаунта. Если во время авто-continue ротация переключила нас на другой аккаунт, у которого в chat_session нет прежнего контекста, продолжение вернуло бы нерелевантный текст — теперь в этом случае цикл аккуратно прерывается.

Ветка стоит на свежем main, сливается чисто, CI зелёный. Готов доработать по замечаниям. Спасибо за проект!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /