crw_extract: items with no was-price return 0 in one run and the current price in another
Environment
- Self-hosted crw (third-party build swack-tools/crw-build-aio-mcp, crw
147c8d6; non-default renderer settingsRENDERER__MODE=chrome,RENDER_JS_DEFAULT=true).crw_extractis upstream code; that build does not patch extraction.
Repro
crw_extract on JB Hi-Fi TV pages (https://www.jbhifi.com.au/collections/tvs/...) with a schema that has a was/original price field.
Expected
Items with no was-price get the same value every run (null/absent).
Actual
Inconsistent between runs: items with no was-price came back as 0 in one run and as the current price in another.
Frequency
Seen in 2 runs; not yet reduced to a stock-crw repro (stock image has no browser, so the Chrome-rendered page could not be compared).
Notes
Looks like LLM-extraction nondeterminism for a missing field. A schema/prompt hint that missing values should be null, or a post-check that rejects a was-price equal to the current price or 0, would make it stable.
thanks, this pointed at a real inconsistency on our side.
the extraction prompt tells the model to use null for a value the page does not have. if the schema types that field as a plain number, that null fails validation, and the retry asks the model for a valid object, so it picks something: 0 one run, the current price the next.
#667 removes only the nulls the validator rejected and re-validates. an optional field the page lacks now comes back absent every run, with no retry. a required field that is null still goes through the normal retry. if you want an explicit null instead of absent, type the field as ["number", "null"].
fixed in #667 and live on the hosted api now. checked with a non-nullable wasPrice on a page that has none: two runs, five items each, wasPrice absent on all of them both times, no 0 and no borrowed price.
self-hosted builds get it with v0.40.0 (release pr #668). thanks for spotting it, closing.