fix(resilience): clear persisted LKGP pin on target exhaustion and skip (#11911) - #12013
Merged
diegosouzapw merged 1 commit intoAug 29, 2026
Conversation
…ip (diegosouzapw#11911) - Clear stale LKGP pins when applyComboTargetExhaustion marks a connection/provider exhausted - Clear stale LKGP pins when targets are skipped before dispatch due to cooldown, lockout, or unavailability - Prevent subsequent combo requests from repeatedly prioritizing dead providers - Add regression tests covering handleComboChat and handleRoundRobinCombo LKGP exhaustion clearing Signed-off-by: Minxi Hou <houminxi@gmail.com>
diegosouzapw
merged commit Aug 29, 2026
38e2baa
into
diegosouzapw:release/v3.8.51
13 of 15 checks passed
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
…omain off the @/lib/localDb barrel import (#11795 Phase 4) (#12053) Resynced onto the release tip after #12051/#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has #12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
#11795 Phase 5) (#12055) Resynced onto the release tip after #12051/#12052/#12053 landed. Same LKGP-clear conflict as #12053 (kept the current clearStaleLKGP() helper at both call sites). One additional issue this final phase's combined-worktree validation surfaced: clearStaleLKGP() itself (added by #12013, which none of the 4 phase PRs could have seen since it landed after they were authored) still had a dynamic `await import("@/lib/localDb")` — a real break once this PR deletes the barrel. Fixed to `await import("@/lib/db/settings")`, matching the direct-import pattern used at every other call site. typecheck:core, check-db-rules, check:cycles, and the eslint-import-boundaries regression test (3/3, including "G14 rejects localDb barrel imports") all green after resync — zero barrel-importing production files remain. Nice clean 5-phase migration, and thanks for taking on the full #11795 cleanup.
5 tasks done
abhisheksharma2411
added a commit
to abhisheksharma2411/OmniRoute
that referenced
this pull request
Sep 9, 2026
…ed target diegosouzapw#12013 cleared the persisted LKGP pin from 13 call sites so a dead provider stops being re-pinned. None of them look at which provider the pin names, and the combo-level pin records whichever provider last succeeded — not necessarily the one failing now. Under auto the pin is a scoring input rather than a hoist: resolveAutoStrategy reads it into lastKnownGoodProvider and feeds it to candidate scoring, so the pinned provider is not necessarily tried first. Skipping an unrelated target — a connection cooldown, a quota cutoff, an unavailable model — therefore threw away a preference for a provider that never failed. Under the lkgp strategy the same call is harmless, because the pinned target is hoisted to the front and so is always the first thing tried. Clear the combo-level pin only when it names the failed target's provider, and — when both carry one — its connection, so a sibling connection failing does not invalidate the pinned one. The target-scoped executionKey pin is still cleared unconditionally; it is unambiguously about the target that failed. Refs diegosouzapw#11911
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ip (diegosouzapw#11911) (diegosouzapw#12013) When an auto/*/lkgp combo target failed into exhaustion (e.g. an unauthenticated free-tier 401) or was skipped pre-dispatch (cooldown, model lockout, unavailability), the Last Known Good Provider pin was never cleared — so subsequent requests kept re-selecting the same dead provider, causing repeated failures and mass-skipping instead of falling through to a healthy target. Centralizes invalidation into clearStaleLKGP(), invoked from both handleComboChat and handleRoundRobinCombo on exhaustion, pre-dispatch skip, and body-specific 400 termination.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…omain off the @/lib/localDb barrel import (diegosouzapw#11795 Phase 4) (diegosouzapw#12053) Resynced onto the release tip after diegosouzapw#12051/diegosouzapw#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has diegosouzapw#12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
diegosouzapw#11795 Phase 5) (diegosouzapw#12055) Resynced onto the release tip after diegosouzapw#12051/diegosouzapw#12052/diegosouzapw#12053 landed. Same LKGP-clear conflict as diegosouzapw#12053 (kept the current clearStaleLKGP() helper at both call sites). One additional issue this final phase's combined-worktree validation surfaced: clearStaleLKGP() itself (added by diegosouzapw#12013, which none of the 4 phase PRs could have seen since it landed after they were authored) still had a dynamic `await import("@/lib/localDb")` — a real break once this PR deletes the barrel. Fixed to `await import("@/lib/db/settings")`, matching the direct-import pattern used at every other call site. typecheck:core, check-db-rules, check:cycles, and the eslint-import-boundaries regression test (3/3, including "G14 rejects localDb barrel imports") all green after resync — zero barrel-importing production files remain. Nice clean 5-phase migration, and thanks for taking on the full diegosouzapw#11795 cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an
auto/*orlkgpcombo's target fails and enters exhaustion sets (applyComboTargetExhaustionmarks the connection/provider exhausted, e.g. an unauthenticated free-tier connection 401), or when a target is skipped before dispatch due to cooldown, model lockout, or unavailability, the Last Known Good Provider (LKGP) pin was NOT cleared.This caused the subsequent requests to re-select the same dead provider as their preferred candidate, resulting in repeated failed requests and mass-skipping before falling through.
Fix
clearStaleLKGP(comboName, executionKey, comboId, log, tag)inopen-sse/services/combo.ts.clearStaleLKGPin bothhandleComboChatandhandleRoundRobinCombowhen:applyComboTargetExhaustionmarks the provider or connection exhausted.tests/unit/lkgp-stale-pin-exhaustion-11911.test.tsverifying that stale pins are cleared on exhaustion and pre-dispatch skips.Closes #11911