Repository navigation
feat(credential-health): per-connection sweep interval via healthCheckInterval (#8443) - #10687
Conversation
…kInterval, opt-out at 0 (cheaper-inference#8443) The sweep reads provider_connections.healthCheckInterval (minutes) per connection: > 0 overrides the global cadence, <= 0 excludes the connection from the sweep (opt-out), absent falls back to CREDENTIAL_HEALTH_CHECK_INTERVAL. On success the scheduler keeps the per-connection timing (nextAttemptAt = lastAttemptAt + interval) instead of clearing it, so a healthy connection is retested on its own schedule. Failure backoff (5min -> 10min -> 30min -> 2h) is unchanged. Also removes dead code in the same file: OAUTH_INTERVAL_MULTIPLIER (never used, header comment claiming OAuth is tested 2x less often was false), getMaxFailuresAcrossConnections (never called), and a leftover interval variable in sweep(). Tests: new credential-health-interval.test.ts (6 cases, replicated predicates per the existing house pattern), backoff-retry adapted to the new success behavior; changelog fragment for cheaper-inference#8443.
a659143 to
c5faf19
Compare
|
Solid, focused feature: per-connection sweep cadence via the already-existing provider_connections.healthCheckInterval column, with |
…ction, call out interval coupling in release notes
|
Thanks for the review! Both optional cleanups are in (commit e2160f7): dropped the unused |
0bfaaa4
into
cheaper-inference:release/v3.8.50
…kInterval (cheaper-inference#8443) (cheaper-inference#10687) Merged — validated together with a batch of related maxmad64bis PRs in one combined worktree (typecheck:core clean, complexity/cognitive-complexity/file-size/changelog gates green, focused tests passing). Thanks for the contribution!
Problem
The credential health scheduler tests every active provider connection on a single global cadence (
CREDENTIAL_HEALTH_CHECK_INTERVAL, default 5 min). There is no way to pace heavy or low-value connections individually, and no per-connection opt-out. Issue #8443 reports the probe volume this generates (~6 000 probe requests/day for ~20 providers, as corrected in the thread).Fix
provider_connections.healthCheckInterval(minutes) per connection:> 0overrides the global cadence,<= 0excludes the connection from the sweep (opt-out), absent falls back to the env default. The column already exists (the token-refresh scheduler uses it) — no migration, no API or UI change (the field is already editable per connection).nextAttemptAt = lastAttemptAt + interval) instead of clearing it, so a healthy connection is retested on its own schedule, not every sweep.OAUTH_INTERVAL_MULTIPLIER(never used — the inert multiplier called out in the issue thread; the header comment claiming OAuth is tested 2x less often was false),getMaxFailuresAcrossConnections(never called), and a leftoverintervalvariable insweep().Note on the shared column: a value set for token-refresh purposes also paces credential tests (and
0disables both) — one knob, two schedulers. A per-connection interval shorter than the global sweep cadence is capped by it (the sweep timer itself is unchanged).Verification
The sweep predicates are replicated in the unit tests, following the existing house pattern for this file (the scheduler auto-initializes on import); the replica and the implementation were aligned line by line.
The full credential-health family (5 files: active-connections-9180, backoff-retry, boot-wiring, interval, search-providers) passes, 0 fail; the three pre-existing files are unchanged and pass as at base.
The full
npm run lintis red on the base branch (25 errors in untouched test files, byte-identical toupstream/release/v3.8.50); the one error above (no-restricted-importson the@/lib/localDbimport) also exists at base. This branch introduces no new lint error.Tests added/modified:
tests/unit/credential-health-interval.test.ts(new),tests/unit/credential-health-backoff-retry.test.ts(adapted: success now spaces the next sweep by the per-connection interval instead of clearing the timing).