Conversation
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
Adds
tests/pixel_inference/test_runtime_policy.py— broader coverage forbin/pixel_provider/runtime_policy.py, the per-call provider eligibility matrix.Why this matters
select_candidatesruns on every routed generation call beforeruntime_gatewayforwards it: it picks the leader-then-backups order, enforces the output-token budget, detects tools/vision/reasoning requirements from the payload, blocks cloud providers unlesspolicy.allowCloud, and prevents route cycles through the ODS/Pixel pseudo-models. A silent wrong answer here either calls a provider that cannot serve the request (generation fails) or routes a request to a cloud provider the owner never authorized (privacy leak).Relationship to existing coverage
tests/pixel_inference/test_provider_policy.pyalready pins the provider-side selection semantics: leader-first ordering, incompatible-backup skipping (contextTokens, maxOutputTokens, supportsTools, enabled),maxAttempts,cloud-not-authorized, route cycles for all three pseudo-models, reasoning requirement,leader-incompatible,provider-routing-disabled, and deep-copy non-mutation.This suite is a superset that adds the payload-detection half of the contract, which the existing file does not exercise:
max_tokens/max_completion_tokensbounds (0, negative, non-int, bool, float, over leader limit), themin(1024, maxOutputTokens)default, backups skipped below the requested budget.toolsfield, arole='tool'message, ortool_callson any message; vision required only viaimage_urlcontent parts (atype='text'list does not trigger it).policy.allowCloudis true; cloud backup (not just leader) rejected without it.maxAttempts=1yields leader only, empty backups, skipped list does not record truncation.Overlapping cases (ordering, route cycles, disabled routing, incompatible skips) intentionally re-pin the same invariants under the independent fixture, matching the superset precedent used in earlier contract PRs.
Overlap check
Searched
runtime_policy,provider routing,candidate— no existing PR touches this module. The relatedruntime_gatewaypolicy work (#5690) covers the HTTP gateway layer; this is the separate pure selection function called before the gateway builds candidates.Validation
Test-only change; revert is a single file deletion.