Skip to content

feat: Customizable peak hour protection - #11622

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
Neuron-Mr-White:feat/provider-peak-hour-protection
Aug 26, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.51from
Neuron-Mr-White:feat/provider-peak-hour-protection

Conversation

@Neuron-Mr-White

Copy link
Copy Markdown
Contributor

Summary

  • add customizable provider-connection peak-hour protection windows in UTC
  • support block/avoid modes and DeepSeek/Z.ai presets in the connection edit UI
  • filter protected connections during credential selection before upstream credential use/request dispatch

Why

Some providers publish peak-hour periods where quota/cost behavior changes in provider-specific ways that are hard to model accurately. This PR adds an operator-controlled protection guard instead of attempting provider-specific multiplier math.

Behavior

  • Protection is disabled unless an operator configures windows on a provider connection.
  • Configured windows are stored under providerSpecificData.peakHourProtection.
  • When a configured window is active, the connection is skipped before upstream credentials are materialized.
  • If every eligible connection for that provider is protected, the request receives a retry-after style rate-limited response.
  • Direct pinned requests are not silently rewritten to another provider/model.

Validation

  • node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --test tests/unit/peak-hour-protection.test.ts
  • focused ESLint on changed files
  • npm run typecheck:core -- --pretty false
  • npm run check:dashboard-typecheck — passed with existing frozen baseline
  • npm run check:open-sse-typecheck — passed with existing frozen baseline
  • Prettier check on changed files
  • Built and smoke-tested in a production-like standalone deployment on the operator's router before opening this PR

Notes

⚠️ base-red inherited: #11449

@diegosouzapw
diegosouzapw merged commit c11f661 into cheaper-inference:release/v3.8.51 Aug 26, 2026
10 of 16 checks passed
@Neuron-Mr-White
Neuron-Mr-White deleted the feat/provider-peak-hour-protection branch August 26, 2026 13:48
diegosouzapw pushed a commit that referenced this pull request Aug 28, 2026
Fixes overnight peak-hour windows so 'days' is interpreted as the UTC day the window STARTS, keeping the post-midnight segment protected until its exclusive end boundary — a Monday-only 22:00-02:00 window incorrectly returned inactive on Tuesday at 01:00Z. TDD RED demonstrated, 5/5 focused tests passing. Follow-up to #11622. Thanks!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…e#11622)

Merged via /merge-batch (lote 2026-08-26 batch 2, v3.8.51). Boarded no worktree combinado junto com outras ~20 PRs; validação única: typecheck/complexity/cognitive-complexity/changelog-integrity verdes, file-size rebaseado onde necessário (crescimento legítimo), lint com os mesmos 228 achados pré-existentes confirmados via sonda contra o tip puro (não introduzidos por este lote), e 292 testes focados (unit) + 18 (vitest) passando. Obrigado pela contribuição.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…nference#11718)

Fixes overnight peak-hour windows so 'days' is interpreted as the UTC day the window STARTS, keeping the post-midnight segment protected until its exclusive end boundary — a Monday-only 22:00-02:00 window incorrectly returned inactive on Tuesday at 01:00Z. TDD RED demonstrated, 5/5 focused tests passing. Follow-up to cheaper-inference#11622. Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants