Skip to content

Fix search query directives dropping clauses and chunked zeroing min_bid - #521

Open
selimfirat wants to merge 1 commit into
vast-ai:masterfrom
selimfirat:fix/skypilot-query-and-min-bid
Open

selimfirat wants to merge 1 commit into
vast-ai:masterfrom
selimfirat:fix/skypilot-query-and-min-bid

Conversation

@selimfirat

@selimfirat selimfirat commented Oct 1, 2026 •

Copy link
Copy Markdown

preprocess_search_query only runs when the query contains georegion=true or chunked=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_cutoffs contains 'min_bid': 0, which overwrites every offer's min_bid with 0. SkyPilot bids min_bid for 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-level query_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, so parse_query raises instead of clauses disappearing. It also removes min_bid from the cutoffs.

#502 fixes the parsing part too, by widening the grammar. Going through parse_query's tokenizer means nin, not in and == work as well, and this also covers min_bid. The SkyPilot side is in skypilot-org/skypilot#10935.

SkyPilot's query:

chunked=true georegion=true geolocation="EU" disk_space>=50 num_gpus=1 gpu_name="RTX 3090" cpu_ram>="64.0"

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_bid 0.

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, with min_bid 0.173 and 0.725.

I added test_chunked_georegion_query_keeps_filters_and_min_bid to tests/sdk/test_sdk.py; it fails on master. pytest cli api sdk scripts gives 977 passed.

This is easy to revert. Only queries with chunked or georegion are affected, so in practice only SkyPilot. They now return fewer offers, all matching the filters, with real min_bid values. One thing to know: the old cutoff also turned a missing min_bid into 0, so SkyPilot's catalog fetcher, which takes max() over min_bid, would now fail on a missing value. None of the ~280 offers I checked had one.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant