Repository navigation
Fix search query directives dropping clauses and chunked zeroing min_bid - #521
Open
selimfirat wants to merge 1 commit into
Open
selimfirat wants to merge 1 commit into
selimfirat wants to merge 1 commit into
Conversation
preprocess_search_query() parsed the query with a pyparsing grammar whose values could not contain quotes or dots, and without parse_all, so every clause from the first quoted or decimal value onward was silently dropped whenever georegion=true or chunked=true was present (e.g. SkyPilot's `geolocation="EU" ... gpu_name="RTX 3090" cpu_ram>="64.0"`). Tokenize with parse_query()'s own pattern instead, keep non-directive clauses verbatim, accept quoted region codes, and pass unparseable input through so parse_query() reports it. postprocess_search_results(chunked=True) listed min_bid in the cutoffs, which overwrote every offer's minimum bid with 0. min_bid is a price, not a capacity to bucket, so drop it from the cutoffs.
selimfirat
marked this pull request as ready for review
October 1, 2026 23:27
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.
preprocess_search_queryonly runs when the query containsgeoregion=trueorchunked=true, which is what SkyPilot sends. Its pyparsing grammar doesn't accept quoted or decimal values and stops at the first one without raising, so every clause after that is dropped. For SkyPilot's query that removes the GPU, region, disk and RAM filters, and SkyPilot ends up renting whatever offer comes back first.Separately,
_chunked_cutoffscontains'min_bid': 0, which overwrites every offer'smin_bidwith 0. SkyPilot bidsmin_bidfor interruptible instances, so it bids $0 and the instance never starts. This is also why SkyPilot's vast catalog shows $0.00 for every spot price.This PR tokenizes with
parse_query's regex (moved to a module-levelquery_pattern) and keeps every clause other than the two directives as written. If the regex can't consume the whole string, the query is passed through unchanged, soparse_queryraises instead of clauses disappearing. It also removesmin_bidfrom the cutoffs.#502 fixes the parsing part too, by widening the grammar. Going through
parse_query's tokenizer meansnin,not inand==work as well, and this also coversmin_bid. The SkyPilot side is in skypilot-org/skypilot#10935.SkyPilot's query:
Before (1.8.2): it preprocesses to an empty string. A live search returned 44 offers across 21 GPU models in 17 countries, all with
min_bid0.After:
geolocation in [<EU countries>] disk_space>=50 num_gpus=1 gpu_name="RTX 3090" cpu_ram>="64.0". The same search returned 2 offers, both RTX 3090s in the EU, withmin_bid0.173 and 0.725.I added
test_chunked_georegion_query_keeps_filters_and_min_bidtotests/sdk/test_sdk.py; it fails on master.pytest cli api sdk scriptsgives 977 passed.This is easy to revert. Only queries with
chunkedorgeoregionare affected, so in practice only SkyPilot. They now return fewer offers, all matching the filters, with realmin_bidvalues. One thing to know: the old cutoff also turned a missingmin_bidinto 0, so SkyPilot's catalog fetcher, which takesmax()overmin_bid, would now fail on a missing value. None of the ~280 offers I checked had one.