Conversation
|
@anupsv is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
Preserve the shared routing snapshot and current admission gates, integrate verified App Attest machine identities, and refresh compatibility tests and documentation.
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
Add opt-in, account-scoped provider affinity with deterministic spillover, preserving existing admission and ordinary-routing fallbacks.
EIGENINFERENCE_ACCOUNT_AFFINITY_MODE=off|shadow|on(defaultoff) andEIGENINFERENCE_ACCOUNT_AFFINITY_MAX_TTFT_PENALTY_MS(default250). Off/shadow preserve the existing winner and prefix-affinity tiebreaker.Before
Ordinary cost and existing prefix-affinity ties determine placement; repeat requests from one account have no dedicated stable machine order. Retry plans retain cost-ranked backups.
flowchart TD Request[Authenticated inference request] --> Scan[scanCandidatesLocked + fillRoutingSnapshotPLocked: shared state, hard gates, and pool preferences] Scan --> Select[selectRoutingCandidateWithAffinity: ordinary cost and equivalent-prefix tie] Select --> Commit{commitProviderReservation: current admission} Commit -->|Admitted| Plan[newDispatchPlan: up to 8 cost-ranked backups] Plan --> Serve[Dispatch inference and stream response] Commit -->|State changed| Scan Scan -->|No admissible candidate| Existing[Existing queue, retry, or error outcome] Serve -->|Retry or hedge| Retry[ReserveNextFromPlan: quote/version preference, then cost order] Retry -->|Current gates pass and debit succeeds| Serve Retry -->|Plan exhausted| Refresh[RefreshDispatchPlan: one full rescan] Refresh --> ScanAfter
Active affinity adds stable account/model/machine ranking with modest load-based spillover. Higher-priority owner/version groups and all hard admission gates remain authoritative; no extra waiting or affinity-only rejection is introduced.
flowchart TD Request[Authenticated inference request] --> Scan[scanCandidatesLocked + fillRoutingSnapshotPLocked: existing gates, shared state, and affinity inputs] Scan --> Legacy[selectRoutingCandidateWithAffinity: unchanged legacy baseline] Legacy --> Mode{Account affinity mode} Mode -->|Off or shadow: retain legacy winner| Commit Mode -->|On| Affinity[evaluateAccountAffinity: account/model/verified-machine HRW] Affinity -->|First warm candidate within own-load, TPS, and deadline bounds| Commit Affinity -->|None feasible: retain legacy winner| Commit Commit{commitProviderReservation: recheck identity/load/config and atomic admission} -->|Admitted| Plan[newDispatchPlan + retainEntryBefore: up to 8 ready-first HRW backups] Commit -->|State changed| Scan Plan --> Serve[Dispatch inference and stream response] Serve -->|Retry or hedge| Retry[reserveAccountAffinityPlan: HRW then cost fallback within each owner/version/quote tier] Retry --> Guard{accountAffinityPlanGuard + current admission under provider lock} Guard -->|Admitted and debited| Serve Guard -->|Unavailable| Next{More candidates or priority tiers?} Next -->|Yes| Retry Next -->|No| Refresh[RefreshDispatchPlan: one full rescan] Refresh --> Scan Scan -->|No admissible candidate| Existing[Existing queue, retry, or error outcome]offandshadowalso keep the legacy retry-plan policy. Shadow evaluates primary-choice counterfactuals without serving those alternatives. The active retry path never rescans the fleet until the existing one-shot refresh.Validation
Passed on local Go 1.27.1, darwin/arm64:
go test ./registry ./registry/routingsim ./modelpolicy -count=1go test ./registry ./api -run '^TestAccountAffinity' -count=1go test -race -p 4 ./registry ./api -run 'Test(AccountAffinity|AppAttest|RoutingSnapshot|Offloaded|ReserveCommit|DispatchPlan|ReserveNextFromPlan|RefreshDispatchPlan|PlanFirst|Hedge|Governor|QueueDrain|Drain)' -count=3BenchmarkAccountAffinityReserve_350x2: off/shadow/on each measure 365 allocs/op on the same 350-provider, two-model attested fixture after merging current master. An untouched archive ofd78ae77efalso measures 365 allocs/op with verified identities (13 without them): this is the upstream baseline, not affinity overhead. The regression now requires affinity to add zero allocations above the identical off-mode fleet. Identity hashing avoids per-provider concatenation allocations; no per-account cache or worker lifecycle was added.make coordinator-build,go vet ./registry ./api ./cmd/coordinator,make docs-impact-check BASE=origin/master,make docs-check, andgit diff --check.The full coordinator suite (
make coordinator-test) is not fully green on this local toolchain. Its only failures are these four existing JSON tests, reproduced on an untouched archive of the updated based78ae77ef:TestJSONStringEncodedLenMatchesEncoderTestJSONEncodedLenLeafCasesTestJSONValueLenMatchesMarshalTestCacheBustSpliceMatchesReencode/canonical_raw_line_separatorsNo live provider-inference E2E or production load experiment was run.
Integration with current master
d78ae77efand preserve the new sharedfillRoutingSnapshotPLockedhelper, native-model offload estimates, and admission budget clamps. Add affinity identity/occupancy to that shared projection, with regression coverage for reused snapshots and disabled mode.Rollout and limits