Repository navigation
Conversation
…rmanent quota refresh errors
This branch has not been deployed
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
Fixes a retry storm and queue overflow (
quota_refresh_queue_full) affecting deployments with dedicatedgrok_console-scoped egress nodes:Use
ScopeConsolefor Console quota and session identity syncconsole.Adapter.syncConsoleQuotas(backend/internal/infra/provider/console/quota.go) andsessionidentity.Fetch(backend/internal/infra/provider/sessionidentity/session.go) previously requestedegress.ScopeWebeven forgrok_consoleaccounts bound togrok_console-scoped egress nodes.egress.SupportsScope(ScopeConsole, ScopeWeb)isfalse(whileSupportsScope(ScopeWeb, ScopeConsole)istrue), every Console account bound to a dedicatedgrok_consolenode failed immediately with绑定出口节点 <id> 与 grok_web 作用域不兼容.ScopeConsoleforgrok_consolecredentials works directly with boundgrok_consolenodes, continues to acceptgrok_webnodes viaSupportsScope/fallbackScopes, and preserves identical browser fingerprint & Clearance handling viaisGrokWebScope(ScopeConsole).sessionidentity.FetchWithLeasenow reports egress feedback usinglease.Scope(defaulting toScopeWeb).Stop infinite retries and queue flooding on non-self-healing quota refresh errors
egress.ErrBoundNodeUnavailableand classify non-self-healing bound-node configuration failures ininfra/egress.Manager.acquireUnavailableFallback(missing node, incompatible scope, disabled node, empty proxy URL) when no fallback can transiently recover them — preserving exact error strings, keeping primary cooldowns / transient DB errors retryable, and keeping transient fallback failures (e.g. a cooling fixed fallback node) retryable.account.Service.runQuotaRefresh, drop entries on permanent errors (ErrNotFound,provider.ErrUnauthorized,egress.ErrBoundNodeUnavailable) and clear shared dirty state (logging clear errors and resettingfailuresif a newer generation arrived concurrently) instead of re-queuing indefinitely at 1-minute backoff.account.Service.ReconcileRateLimit, skip queuingQueueQuotaRefreshon permanent errors.account.Service.syncConsoleQuotaAccounts, avoid double-scheduling periodicconsole_usage_migrationfailures intoquotaRefreshQueue(migration already retries on its own periodic schedule) and skip queuing permanent errors orprovider.ErrEgressBlockedon catch-up batches.Test Plan
TestAcquireCredentialBoundNodeUnavailableClassificationinbackend/internal/infra/egress/manager_test.gocovering missing/incompatible/disabled/empty-proxy bound nodes, transient DB/cooldown errors, and cooling vs disabled fixed fallbacks.TestFetchSelectsScopeByProviderAndReportsLeaseScopeinbackend/internal/infra/provider/sessionidentity/session_test.go.TestSyncQuotaAndIdentityUseBoundConsoleScopedEgressNodeinbackend/internal/infra/provider/console/console_protocol_test.go.TestQuotaRefreshDropsPermanentErrorsWithoutRetryinginbackend/internal/application/account/quota_refresh_test.gocovering permanent error dropping, concurrent generation failure reset,ReconcileRateLimit, andsyncConsoleQuotaAccountsqueue policy.gofmt,go vet ./..., andgo test -race -count=1 ./internal/domain/egress ./internal/infra/egress ./internal/infra/provider/console ./internal/infra/provider/sessionidentity ./internal/application/account ./internal/app— all pass.grok_consoleaccounts bound togrok_consolenodes:作用域不兼容errors andquota_refresh_queue_fulldropped to 0.